Skip to content

Updated TypeScript version into 2.4.1 #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from Jul 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = function(grunt)
src: 'dist/test',
options: {
mask: '*.js',
timeout: 4000
timeout: 10000
}
}
}
Expand Down Expand Up @@ -120,7 +120,13 @@ module.exports = function(grunt)
target: 'ES5',
module: 'CommonJS',
experimentalDecorators: true,
jsx: 'react'
jsx: 'react',
lib: [
"lib.dom.d.ts",
"lib.es5.d.ts",
"lib.es2015.iterable.d.ts",
"lib.es2015.collection.d.ts"
],
});

FS.readdirSync(Path.join(base)).forEach(function(directory) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"progress": "^2.0.0",
"shelljs": "^0.7.0",
"typedoc-default-themes": "^0.5.0",
"typescript": "2.3.4"
"typescript": "2.4.1"
},
"devDependencies": {
"@types/mocha": "^2.2.39",
Expand All @@ -71,7 +71,7 @@
"LICENSE"
],
"scripts": {
"test": "mocha -t 4000 dist/test",
"test": "mocha -t 10000 dist/test",
"build": "grunt build_and_test",
"prepublish": "npm run build"
},
Expand Down
6 changes: 3 additions & 3 deletions src/lib/converter/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ export class Converter extends ChildableComponent<Application, ConverterComponen
this.typeNodeConverters = [];
}

addComponent(name: string, componentClass: ComponentClass<ConverterComponent>): ConverterComponent {
addComponent<T extends ConverterComponent & Component>(name: string, componentClass: T | ComponentClass<T>): T {
const component = super.addComponent(name, componentClass);
if (component instanceof ConverterNodeComponent) {
this.addNodeConverter(component);
} else if (component instanceof ConverterTypeComponent) {
this.addTypeConverter(<TypeTypeConverter<any>|TypeNodeConverter<any, any>> component);
this.addTypeConverter(component);
}

return component;
Expand All @@ -201,7 +201,7 @@ export class Converter extends ChildableComponent<Application, ConverterComponen
}
}

private addTypeConverter(converter: TypeTypeConverter<any>|TypeNodeConverter<any, any>) {
private addTypeConverter(converter: ConverterTypeComponent) {
if ('supportsNode' in converter && 'convertNode' in converter) {
this.typeNodeConverters.push(<TypeNodeConverter<any, any>> converter);
this.typeNodeConverters.sort((a, b) => (b.priority || 0) - (a.priority || 0));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/types/string-literal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ export class StringLiteralConverter extends ConverterTypeComponent implements Ty
* @returns The type reflection representing the given string literal type.
*/
convertType(context: Context, type: ts.LiteralType): Type {
return new StringLiteralType(type.text);
return new StringLiteralType(<string> type.value);
}
}
2 changes: 1 addition & 1 deletion src/lib/utils/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ComponentOptions {
const childMappings: {host: any, child: Function}[] = [];

export function Component(options: ComponentOptions): ClassDecorator {
return (target: ComponentClass<Component>) => {
return (target: Function) => {
const proto = target.prototype;
if (!(proto instanceof AbstractComponent)) {
throw new Error('The `Component` decorator can only be used with a subclass of `AbstractComponent`.');
Expand Down
6 changes: 3 additions & 3 deletions src/test/converter/decorators/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function decoratorWithParam(value:boolean):MethodDecorator {
* @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}):ClassDecorator {
function decoratorWithOptions(options:{name:string}): ClassDecorator {
return function (target) {
target.options = options;
}
(target as any).options = options;
};
}
4 changes: 2 additions & 2 deletions src/test/converter/react/react.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ declare namespace __React {
// ----------------------------------------------------------------------

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

// Base component for plain JS classes
class Component<P, S> implements ComponentLifecycle<P, S> {
class Component<P, S> {
constructor(props?: P, context?: any);
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
setState(state: S, callback?: () => any): void;
Expand Down
17 changes: 0 additions & 17 deletions src/test/converter/react/specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,23 +603,6 @@
}
]
}
],
"implementedTypes": [
{
"type": "reference",
"name": "ComponentLifecycle",
"typeArguments": [
{
"type": "reference",
"name": "DemoProps",
"id": 2
},
{
"type": "intrinsic",
"name": "any"
}
]
}
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"es2015.collection",
"es2015.iterable"
],
"target": "ES5",
"target": "es5",
"noImplicitAny": false,
"removeComments": true,
"noUnusedLocals": true,
Expand Down