Skip to content

Commit 3bbf940

Browse files
Aleix Morgadasblakeembrey
authored andcommitted
Update TypeScript to 2.4.1 (TypeStrong#549)
1 parent 22be6b6 commit 3bbf940

File tree

9 files changed

+21
-32
lines changed

9 files changed

+21
-32
lines changed

gruntfile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module.exports = function(grunt)
9090
src: 'dist/test',
9191
options: {
9292
mask: '*.js',
93-
timeout: 4000
93+
timeout: 10000
9494
}
9595
}
9696
}
@@ -120,7 +120,13 @@ module.exports = function(grunt)
120120
target: 'ES5',
121121
module: 'CommonJS',
122122
experimentalDecorators: true,
123-
jsx: 'react'
123+
jsx: 'react',
124+
lib: [
125+
"lib.dom.d.ts",
126+
"lib.es5.d.ts",
127+
"lib.es2015.iterable.d.ts",
128+
"lib.es2015.collection.d.ts"
129+
],
124130
});
125131

126132
FS.readdirSync(Path.join(base)).forEach(function(directory) {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"progress": "^2.0.0",
4747
"shelljs": "^0.7.0",
4848
"typedoc-default-themes": "^0.5.0",
49-
"typescript": "2.3.4"
49+
"typescript": "2.4.1"
5050
},
5151
"devDependencies": {
5252
"@types/mocha": "^2.2.39",
@@ -71,7 +71,7 @@
7171
"LICENSE"
7272
],
7373
"scripts": {
74-
"test": "mocha -t 4000 dist/test",
74+
"test": "mocha -t 10000 dist/test",
7575
"build": "grunt build_and_test",
7676
"prepublish": "npm run build"
7777
},

src/lib/converter/converter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ export class Converter extends ChildableComponent<Application, ConverterComponen
184184
this.typeNodeConverters = [];
185185
}
186186

187-
addComponent(name: string, componentClass: ComponentClass<ConverterComponent>): ConverterComponent {
187+
addComponent<T extends ConverterComponent & Component>(name: string, componentClass: T | ComponentClass<T>): T {
188188
const component = super.addComponent(name, componentClass);
189189
if (component instanceof ConverterNodeComponent) {
190190
this.addNodeConverter(component);
191191
} else if (component instanceof ConverterTypeComponent) {
192-
this.addTypeConverter(<TypeTypeConverter<any>|TypeNodeConverter<any, any>> component);
192+
this.addTypeConverter(component);
193193
}
194194

195195
return component;
@@ -201,7 +201,7 @@ export class Converter extends ChildableComponent<Application, ConverterComponen
201201
}
202202
}
203203

204-
private addTypeConverter(converter: TypeTypeConverter<any>|TypeNodeConverter<any, any>) {
204+
private addTypeConverter(converter: ConverterTypeComponent) {
205205
if ('supportsNode' in converter && 'convertNode' in converter) {
206206
this.typeNodeConverters.push(<TypeNodeConverter<any, any>> converter);
207207
this.typeNodeConverters.sort((a, b) => (b.priority || 0) - (a.priority || 0));

src/lib/converter/types/string-literal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ export class StringLiteralConverter extends ConverterTypeComponent implements Ty
4949
* @returns The type reflection representing the given string literal type.
5050
*/
5151
convertType(context: Context, type: ts.LiteralType): Type {
52-
return new StringLiteralType(type.text);
52+
return new StringLiteralType(<string> type.value);
5353
}
5454
}

src/lib/utils/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface ComponentOptions {
2525
const childMappings: {host: any, child: Function}[] = [];
2626

2727
export function Component(options: ComponentOptions): ClassDecorator {
28-
return (target: ComponentClass<Component>) => {
28+
return (target: Function) => {
2929
const proto = target.prototype;
3030
if (!(proto instanceof AbstractComponent)) {
3131
throw new Error('The `Component` decorator can only be used with a subclass of `AbstractComponent`.');

src/test/converter/decorators/decorators.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ function decoratorWithParam(value:boolean):MethodDecorator {
4141
* @param options The options object of this decorator.
4242
* @param options.name A property on the options object of this decorator.
4343
*/
44-
function decoratorWithOptions(options:{name:string}):ClassDecorator {
44+
function decoratorWithOptions(options:{name:string}): ClassDecorator {
4545
return function (target) {
46-
target.options = options;
47-
}
46+
(target as any).options = options;
47+
};
4848
}

src/test/converter/react/react.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ declare namespace __React {
131131
// ----------------------------------------------------------------------
132132

133133
// Base component for plain JS classes
134-
class Component<P, S> implements ComponentLifecycle<P, S> {
134+
class Component<P, S> {
135135
constructor(props?: P, context?: any);
136136
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
137137
setState(state: S, callback?: () => any): void;
@@ -932,7 +932,7 @@ declare module "react/addons" {
932932
// ----------------------------------------------------------------------
933933

934934
// Base component for plain JS classes
935-
class Component<P, S> implements ComponentLifecycle<P, S> {
935+
class Component<P, S> {
936936
constructor(props?: P, context?: any);
937937
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
938938
setState(state: S, callback?: () => any): void;

src/test/converter/react/specs.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -603,23 +603,6 @@
603603
}
604604
]
605605
}
606-
],
607-
"implementedTypes": [
608-
{
609-
"type": "reference",
610-
"name": "ComponentLifecycle",
611-
"typeArguments": [
612-
{
613-
"type": "reference",
614-
"name": "DemoProps",
615-
"id": 2
616-
},
617-
{
618-
"type": "intrinsic",
619-
"name": "any"
620-
}
621-
]
622-
}
623606
]
624607
},
625608
{

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"es2015.collection",
88
"es2015.iterable"
99
],
10-
"target": "ES5",
10+
"target": "es5",
1111
"noImplicitAny": false,
1212
"removeComments": true,
1313
"noUnusedLocals": true,

0 commit comments

Comments
 (0)