2017-09-30 07:01:00 +02:00
|
|
|
// @target: esnext
|
|
|
|
// @module: esnext
|
|
|
|
// @experimentalDecorators: true
|
|
|
|
|
|
|
|
// Angular-style Input/Output API:
|
|
|
|
declare function Input(bindingPropertyName?: string): any;
|
|
|
|
class FooComponent {
|
|
|
|
@Input foo: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Glimmer-style tracked API:
|
|
|
|
declare const tracked: PropertyDecorator & { (...watchedProperties: string[]): any; }
|
|
|
|
|
|
|
|
class Person {
|
|
|
|
@tracked person; any;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MultiplyByTwo {
|
|
|
|
args: any;
|
|
|
|
@tracked('args')
|
|
|
|
get multiplied() {
|
|
|
|
return this.args.number * 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Other fun stuff.
|
|
|
|
|
|
|
|
interface OmniDecorator extends MethodDecorator, ClassDecorator, PropertyDecorator {
|
|
|
|
}
|
|
|
|
|
|
|
|
declare function noArgs(): OmniDecorator;
|
|
|
|
declare function allRest(...args: any[]): OmniDecorator;
|
|
|
|
declare function oneOptional(x?: any): OmniDecorator;
|
|
|
|
declare function twoOptional(x?: any, y?: any): OmniDecorator;
|
|
|
|
declare function threeOptional(x?: any, y?: any, z?: any): OmniDecorator;
|
|
|
|
declare function oneOptionalWithRest(x?: any, ...args: any[]): OmniDecorator;
|
2017-10-03 03:00:00 +02:00
|
|
|
declare const anyDec: any;
|
2017-09-30 07:01:00 +02:00
|
|
|
|
|
|
|
@noArgs
|
|
|
|
class A {
|
|
|
|
@noArgs foo: any;
|
|
|
|
@noArgs bar() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
@allRest
|
|
|
|
class B {
|
|
|
|
@allRest foo: any;
|
|
|
|
@allRest bar() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
@oneOptional
|
|
|
|
class C {
|
|
|
|
@oneOptional foo: any;
|
|
|
|
@oneOptional bar() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
@twoOptional
|
|
|
|
class D {
|
|
|
|
@twoOptional foo: any;
|
|
|
|
@twoOptional bar() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
@threeOptional
|
|
|
|
class E {
|
|
|
|
@threeOptional foo: any;
|
|
|
|
@threeOptional bar() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
@oneOptionalWithRest
|
|
|
|
class F {
|
|
|
|
@oneOptionalWithRest foo: any;
|
|
|
|
@oneOptionalWithRest bar() { }
|
|
|
|
}
|
|
|
|
|
2017-10-03 03:00:00 +02:00
|
|
|
@anyDec
|
|
|
|
class G {
|
|
|
|
@anyDec foo: any;
|
|
|
|
@anyDec bar() { }
|
|
|
|
}
|
|
|
|
|
2017-09-30 07:01:00 +02:00
|
|
|
export { };
|