Skip to content

Commit

Permalink
Update decorators test to meet TypeScript 1.6 specs
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-lenz committed Sep 9, 2015
1 parent b4d2225 commit 96a6a84
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
16 changes: 8 additions & 8 deletions test/converter/decorators/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class DecoratedClass
/**
* A decorator with no options.
*/
function decoratorAtom(target, key, descriptor) {
descriptor.writable = false;
function decoratorAtom(target:Object, propertyKey:string|symbol, descriptor:TypedPropertyDescriptor<any>) {
target[propertyKey].writable = true;
}


Expand All @@ -31,9 +31,9 @@ function decoratorAtom(target, key, descriptor) {
*
* @param value The parameter of this decorator.
*/
function decoratorWithParam(value:boolean) {
return function (target, key, descriptor) {
descriptor.enumerable = value;
function decoratorWithParam(value:boolean):MethodDecorator {
return function (target:Object, propertyKey:string|symbol, descriptor:TypedPropertyDescriptor<any>) {
target[propertyKey].enumerable = value;
}
}

Expand All @@ -44,8 +44,8 @@ function decoratorWithParam(value:boolean) {
* @param options The options object of this decorator.
* @param options.name A property on the options object of this decorator.
*/
function decoratorWithOptions(options:{name:string}) {
return function (target, key, descriptor) {
descriptor.options = options;
function decoratorWithOptions(options:{name:string}):ClassDecorator {
return function (target) {
target.options = options;
}
}
33 changes: 24 additions & 9 deletions test/converter/decorators/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,28 @@
"kindString": "Parameter",
"flags": {},
"type": {
"type": "instrinct",
"name": "any"
"type": "reference",
"name": "Object"
}
},
{
"id": 8,
"name": "key",
"name": "propertyKey",
"kind": 32768,
"kindString": "Parameter",
"flags": {},
"type": {
"type": "instrinct",
"name": "any"
"type": "union",
"types": [
{
"type": "instrinct",
"name": "string"
},
{
"type": "instrinct",
"name": "symbol"
}
]
}
},
{
Expand All @@ -145,8 +154,14 @@
"kindString": "Parameter",
"flags": {},
"type": {
"type": "instrinct",
"name": "any"
"type": "reference",
"name": "TypedPropertyDescriptor",
"typeArguments": [
{
"type": "instrinct",
"name": "any"
}
]
}
}
],
Expand Down Expand Up @@ -229,7 +244,7 @@
],
"type": {
"type": "reference",
"name": "__function"
"name": "ClassDecorator"
}
}
]
Expand Down Expand Up @@ -275,7 +290,7 @@
],
"type": {
"type": "reference",
"name": "__function"
"name": "MethodDecorator"
}
}
]
Expand Down

0 comments on commit 96a6a84

Please sign in to comment.