Skip to content

Commit eb1cc7b

Browse files
Micha Reiserblakeembrey
Micha Reiser
authored andcommitted
Upgrade to typescript 2.0.3 (#290)
1 parent 6dfaec8 commit eb1cc7b

File tree

11 files changed

+1366
-474
lines changed

11 files changed

+1366
-474
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"progress": "^1.1.8",
4040
"shelljs": "^0.7.0",
4141
"typedoc-default-themes": "^0.4.0",
42-
"typescript": "1.8.10"
42+
"typescript": "2.0.3"
4343
},
4444
"devDependencies": {
4545
"grunt": "^1.0.1",

src/lib/converter/context.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class Context
5555
/**
5656
* The currently set type parameters.
5757
*/
58-
typeParameters:ts.Map<Type>;
58+
typeParameters:ts.MapLike<Type>;
5959

6060
/**
6161
* The currently set type arguments.
@@ -360,8 +360,8 @@ export class Context
360360
* @param preserve Should the currently set type parameters of the context be preserved?
361361
* @returns The resulting type mapping.
362362
*/
363-
private extractTypeParameters(parameters:ts.NodeArray<ts.TypeParameterDeclaration>, preserve?:boolean):ts.Map<Type> {
364-
var typeParameters:ts.Map<Type> = {};
363+
private extractTypeParameters(parameters:ts.NodeArray<ts.TypeParameterDeclaration>, preserve?:boolean):ts.MapLike<Type> {
364+
var typeParameters:ts.MapLike<Type> = {};
365365

366366
if (preserve) {
367367
for (var key in this.typeParameters) {

src/lib/converter/nodes/module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ModuleConverter extends ConverterNodeComponent<ts.ModuleDeclaration
3131
context.withScope(reflection, () => {
3232
var opt = context.getCompilerOptions();
3333
if (parent instanceof ProjectReflection && !context.isDeclaration &&
34-
(!opt.module || opt.module == ts.ModuleKind.None)) {
34+
(!module || module.valueOf() === ts.ModuleKind.None.valueOf())) {
3535
reflection.setFlag(ReflectionFlag.Exported);
3636
}
3737

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Context} from "../context";
66

77

88
@Component({name:'type:string-literal'})
9-
export class StringLiteralConverter extends ConverterTypeComponent implements ITypeConverter<ts.StringLiteralType, ts.StringLiteral>
9+
export class StringLiteralConverter extends ConverterTypeComponent implements ITypeConverter<ts.LiteralType, ts.StringLiteral>
1010
{
1111
/**
1212
* Test whether this converter can handle the given TypeScript node.
@@ -19,7 +19,7 @@ export class StringLiteralConverter extends ConverterTypeComponent implements IT
1919
/**
2020
* Test whether this converter can handle the given TypeScript type.
2121
*/
22-
supportsType(context:Context, type:ts.StringLiteralType):boolean {
22+
supportsType(context:Context, type:ts.LiteralType):boolean {
2323
return !!(type.flags & ts.TypeFlags.StringLiteral);
2424
}
2525

@@ -36,7 +36,7 @@ export class StringLiteralConverter extends ConverterTypeComponent implements IT
3636
* @param node The string literal node that should be converted.
3737
* @returns The type reflection representing the given string literal node.
3838
*/
39-
convertNode(context:Context, node:ts.StringLiteral):StringLiteralType {
39+
convertNode(context:Context, node:ts.StringLiteral):Type {
4040
return new StringLiteralType(node.text);
4141
}
4242

@@ -53,7 +53,7 @@ export class StringLiteralConverter extends ConverterTypeComponent implements IT
5353
* @param type The intrinsic type that should be converted.
5454
* @returns The type reflection representing the given string literal type.
5555
*/
56-
convertType(context:Context, type:ts.StringLiteralType):StringLiteralType {
56+
convertType(context:Context, type:ts.LiteralType):Type {
5757
return new StringLiteralType(type.text);
5858
}
5959
}

src/lib/converter/types/tuple.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Context} from "../context";
66

77

88
@Component({name:'type:tuple'})
9-
export class TupleConverter extends ConverterTypeComponent implements ITypeConverter<ts.TupleType, ts.TupleTypeNode>
9+
export class TupleConverter extends ConverterTypeComponent implements ITypeConverter<ts.TypeReference, ts.TupleTypeNode>
1010
{
1111
/**
1212
* Test whether this converter can handle the given TypeScript node.
@@ -19,7 +19,7 @@ export class TupleConverter extends ConverterTypeComponent implements ITypeConve
1919
/**
2020
* Test whether this converter can handle the given TypeScript type.
2121
*/
22-
supportsType(context:Context, type:ts.TupleType):boolean {
22+
supportsType(context:Context, type:ts.TypeReference):boolean {
2323
return !!(type.flags & ts.TypeFlags.Tuple);
2424
}
2525

@@ -62,10 +62,10 @@ export class TupleConverter extends ConverterTypeComponent implements ITypeConve
6262
* @param type The tuple type that should be converted.
6363
* @returns The type reflection representing the given tuple type.
6464
*/
65-
convertType(context:Context, type:ts.TupleType):TupleType {
65+
convertType(context:Context, type:ts.TypeReference):TupleType {
6666
var elements:Type[];
67-
if (type.elementTypes) {
68-
elements = type.elementTypes.map((t) => this.owner.convertType(context, null, t));
67+
if (type.typeArguments) {
68+
elements = type.typeArguments.map((t) => this.owner.convertType(context, null, t));
6969
} else {
7070
elements = [];
7171
}

src/lib/converter/utils/compiler-host.ts

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const ERROR_UNSUPPORTED_FILE_ENCODING = -2147024809;
1515
*/
1616
export class CompilerHost extends ConverterComponent implements ts.CompilerHost
1717
{
18+
1819
/**
1920
* The full path of the current directory. Result cache of [[getCurrentDirectory]].
2021
*/
@@ -59,6 +60,10 @@ export class CompilerHost extends ConverterComponent implements ts.CompilerHost
5960
return Path.join(path, lib);
6061
}
6162

63+
getDirectories(path: string): string[] {
64+
return ts.sys.getDirectories(path);
65+
}
66+
6267

6368
/**
6469
* Return the full path of the current directory.

src/lib/utils/component.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function Component(options:IComponentOptions):ClassDecorator {
5959

6060
var name = options.name;
6161
if (name) {
62-
proto._componentName = name;
62+
proto.componentName = name;
6363
}
6464

6565
var internal = !!options.internal;
@@ -130,7 +130,7 @@ export abstract class AbstractComponent<O extends IComponentHost> extends EventD
130130
/**
131131
* The name of this component as set by the @Component decorator.
132132
*/
133-
private _componentName:string;
133+
public componentName:string;
134134

135135
/**
136136
* A list of options defined by this component.
@@ -174,12 +174,6 @@ export abstract class AbstractComponent<O extends IComponentHost> extends EventD
174174
return this._componentOptions ? this._componentOptions.slice() : [];
175175
}
176176

177-
178-
get componentName():string {
179-
return this._componentName;
180-
}
181-
182-
183177
/**
184178
* Return the application / root component instance.
185179
*/
@@ -250,7 +244,7 @@ export abstract class ChildableComponent<O extends IComponentHost, C extends ICo
250244
}
251245

252246

253-
addComponent<T extends C>(name:string, componentClass:T|IComponentClass<T>):T {
247+
addComponent<T extends C & IComponent>(name:string, componentClass:T|IComponentClass<T>):T {
254248
if (!this._componentChildren) {
255249
this._componentChildren = {};
256250
}

src/lib/utils/fs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as FS from "fs";
55
/**
66
* List of known existent directories. Used to speed up [[directoryExists]].
77
*/
8-
var existingDirectories:ts.Map<boolean> = {};
8+
var existingDirectories:ts.MapLike<boolean> = {};
99

1010

1111
/**

0 commit comments

Comments
 (0)