Skip to content

Commit 96a6a84

Browse files
Update decorators test to meet TypeScript 1.6 specs
1 parent b4d2225 commit 96a6a84

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

test/converter/decorators/decorators.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class DecoratedClass
2121
/**
2222
* A decorator with no options.
2323
*/
24-
function decoratorAtom(target, key, descriptor) {
25-
descriptor.writable = false;
24+
function decoratorAtom(target:Object, propertyKey:string|symbol, descriptor:TypedPropertyDescriptor<any>) {
25+
target[propertyKey].writable = true;
2626
}
2727

2828

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

@@ -44,8 +44,8 @@ function decoratorWithParam(value:boolean) {
4444
* @param options The options object of this decorator.
4545
* @param options.name A property on the options object of this decorator.
4646
*/
47-
function decoratorWithOptions(options:{name:string}) {
48-
return function (target, key, descriptor) {
49-
descriptor.options = options;
47+
function decoratorWithOptions(options:{name:string}):ClassDecorator {
48+
return function (target) {
49+
target.options = options;
5050
}
5151
}

test/converter/decorators/specs.json

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,28 @@
123123
"kindString": "Parameter",
124124
"flags": {},
125125
"type": {
126-
"type": "instrinct",
127-
"name": "any"
126+
"type": "reference",
127+
"name": "Object"
128128
}
129129
},
130130
{
131131
"id": 8,
132-
"name": "key",
132+
"name": "propertyKey",
133133
"kind": 32768,
134134
"kindString": "Parameter",
135135
"flags": {},
136136
"type": {
137-
"type": "instrinct",
138-
"name": "any"
137+
"type": "union",
138+
"types": [
139+
{
140+
"type": "instrinct",
141+
"name": "string"
142+
},
143+
{
144+
"type": "instrinct",
145+
"name": "symbol"
146+
}
147+
]
139148
}
140149
},
141150
{
@@ -145,8 +154,14 @@
145154
"kindString": "Parameter",
146155
"flags": {},
147156
"type": {
148-
"type": "instrinct",
149-
"name": "any"
157+
"type": "reference",
158+
"name": "TypedPropertyDescriptor",
159+
"typeArguments": [
160+
{
161+
"type": "instrinct",
162+
"name": "any"
163+
}
164+
]
150165
}
151166
}
152167
],
@@ -229,7 +244,7 @@
229244
],
230245
"type": {
231246
"type": "reference",
232-
"name": "__function"
247+
"name": "ClassDecorator"
233248
}
234249
}
235250
]
@@ -275,7 +290,7 @@
275290
],
276291
"type": {
277292
"type": "reference",
278-
"name": "__function"
293+
"name": "MethodDecorator"
279294
}
280295
}
281296
]

0 commit comments

Comments
 (0)