From 2495d49c0b5003e5dc3abcbbe89f77afa32a4a8e Mon Sep 17 00:00:00 2001 From: benthomasknight Date: Wed, 17 Jan 2018 12:07:42 +1100 Subject: [PATCH] Included enumerable into the type definition Reordered the definition to group by: - Property and Method decorators - Property Decorators - Method Decorators --- index.d.ts | 62 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/index.d.ts b/index.d.ts index 46019f6..33ba6c7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -17,18 +17,41 @@ export interface DeprecateOption { } /** - * Forces invocations of this function to always have this refer to the class instance, - * even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method; + * Marks a property or method as not being writable. */ -export const autobind: Function; +export const readonly: PropertyOrMethodDecorator; /** * Marks a property or method as not being writable. */ -export const readonly: PropertyOrMethodDecorator; +export const nonconfigurable: PropertyOrMethodDecorator; /** - * Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain. + * Immediately applies the provided function and arguments to the method, allowing you to wrap methods with arbitrary helpers like those provided by lodash. + * The first argument is the function to apply, all further arguments will be passed to that decorating function. */ -export const override: MethodDecorator; +export function decorate(func: Function, ...args: any[]): MethodDecorator; +/** + * Marks a property or method as not being writable. + */ +export const extendDescriptor: PropertyOrMethodDecorator; + + +/** + * Marks a property or method as not being enumerable. + */ +export const nonenumerable: PropertyOrMethodDecorator; +/** + * Prevents a property initializer from running until the decorated property is actually looked up. + * Useful to prevent excess allocations that might otherwise not be used, but be careful not to over-optimize things. + */ +export const lazyInitialize: PropertyDecorator; + + + +/** + * Forces invocations of this function to always have this refer to the class instance, + * even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method; + */ +export const autobind: Function; /** * Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading. */ @@ -42,28 +65,23 @@ export const deprecated: Deprecate; */ export const suppressWarnings: MethodDecorator; /** - * Marks a property or method as not being enumerable. + * Marks a property or method as being enumerable. */ -export const nonenumerable: PropertyOrMethodDecorator; +export const enumerable: MethodDecorator; /** - * Marks a property or method as not being writable. - */ -export const nonconfigurable: PropertyOrMethodDecorator; -/** - * Initial implementation included, likely slow. WIP. + * Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain. */ -export const memoize: MethodDecorator; +export const override: MethodDecorator; /** - * Immediately applies the provided function and arguments to the method, allowing you to wrap methods with arbitrary helpers like those provided by lodash. - * The first argument is the function to apply, all further arguments will be passed to that decorating function. + * Uses console.time and console.timeEnd to provide function timings with a unique label whose default prefix is ClassName.method. Supply a first argument to override the prefix: */ -export function decorate(func: Function, ...args: any[]): MethodDecorator; +export function time(label: string, console?: Console): MethodDecorator; /** - * Prevents a property initializer from running until the decorated property is actually looked up. - * Useful to prevent excess allocations that might otherwise not be used, but be careful not to over-optimize things. + * Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain. */ -export const lazyInitialize: PropertyDecorator; +export const profile: MethodDecorator; + /** - * Uses console.time and console.timeEnd to provide function timings with a unique label whose default prefix is ClassName.method. Supply a first argument to override the prefix: + * Initial implementation included, likely slow. WIP. */ -export function time(label: string, console?: Console): MethodDecorator; +export const memoize: MethodDecorator;