Skip to content
This repository has been archived by the owner on Oct 15, 2018. It is now read-only.

Commit

Permalink
#135 - Temp TS < 2.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed May 31, 2016
1 parent a2c75b1 commit 24d968c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/build/generateDefinitionFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ export function generateDefinitionFile() {
m.name !== "addType");
def.properties = def.properties.filter(p => p.name.indexOf("fill") === -1 && p.name !== "addType");
}

// hack to support the return type expression being "this" in the definition file
// todo: remove in TS 2.0+
if (def.name === "BaseParameterDefinition" && def.isClassDefinition()) {
def.getMethod("addDestructuringProperties").returnTypeExpression.text = "this";
}
});

const definitionFileText = fileInfo.writeExportsAsDefinitionFile({
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/base/BaseParameterDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export abstract class BaseParameterDefinition extends BaseDefinition implements
name: string;
// TypeExpressionedDefinition
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => this;
setTypeExpression: (text: string) => any;
// DefaultExpressionedDefinition
defaultExpression: ExpressionDefinition;
}
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/base/BasePropertyDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export abstract class BasePropertyDefinition extends BaseDefinition implements N
name: string;
// TypeExpressionedDefinition
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => this;
setTypeExpression: (text: string) => any;
}

applyMixins(BasePropertyDefinition, BaseDefinition, [NamedDefinition, TypeExpressionedDefinition]);
2 changes: 1 addition & 1 deletion src/definitions/base/TypeExpressionedDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export abstract class TypeExpressionedDefinition {

setTypeExpression(text: string) {
this.typeExpression = new StructureFactory().getTypeExpressionFromText(text);
return this;
return this as any;
}
}
2 changes: 1 addition & 1 deletion src/definitions/general/TypeAliasDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class TypeAliasDefinition extends BaseDefinition
isDefaultExportOfFile: boolean;
// TypeExpressionedDefinition
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => this;
setTypeExpression: (text: string) => any;
// TypeParameteredDefinition
typeParameters: TypeParameterDefinition[];
addTypeParameters: (...typeParameters: TypeParameterStructure[]) => this;
Expand Down
2 changes: 1 addition & 1 deletion src/definitions/variable/VariableDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class VariableDefinition extends BaseDefinition
isDefaultExportOfFile: boolean;
// TypeExpressionedDefinition
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => this;
setTypeExpression: (text: string) => any;
// DefaultExpressionedDefinition
defaultExpression: ExpressionDefinition;
// AmbientableDefinition
Expand Down
8 changes: 7 additions & 1 deletion ts-type-info.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export abstract class AsyncableDefinition {

export abstract class TypeExpressionedDefinition {
typeExpression: TypeExpressionDefinition;

setTypeExpression(text: string): any;
}

export abstract class DefaultExpressionedDefinition {
Expand Down Expand Up @@ -160,6 +162,7 @@ export abstract class BasePropertyDefinition extends BaseDefinition implements N
isOptional: boolean;
name: string;
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => any;

constructor(definitionType: DefinitionType);
}
Expand Down Expand Up @@ -205,11 +208,12 @@ export abstract class BaseParameterDefinition extends BaseDefinition implements
destructuringProperties: ObjectPropertyDefinition[];
name: string;
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => any;
defaultExpression: ExpressionDefinition;

constructor(definitionType: DefinitionType);

addDestructuringProperties(...properties: ObjectPropertyStructure[]): this;
addDestructuringProperties(...properties: ObjectPropertyStructure[]): any;
getDestructuringProperty(nameOrSearchFunction: string | ((property: ObjectPropertyDefinition) => boolean)): ObjectPropertyDefinition;
}

Expand Down Expand Up @@ -267,6 +271,7 @@ export class TypeAliasDefinition extends BaseDefinition implements NamedDefiniti
isNamedExportOfFile: boolean;
isDefaultExportOfFile: boolean;
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => any;
typeParameters: TypeParameterDefinition[];
addTypeParameters: (...typeParameters: TypeParameterStructure[]) => this;
getTypeParameter: (nameOrSearchFunction: string | ((typeParameter: TypeParameterDefinition) => boolean)) => TypeParameterDefinition;
Expand Down Expand Up @@ -695,6 +700,7 @@ export class VariableDefinition extends BaseDefinition implements NamedDefinitio
isNamedExportOfFile: boolean;
isDefaultExportOfFile: boolean;
typeExpression: TypeExpressionDefinition;
setTypeExpression: (text: string) => any;
defaultExpression: ExpressionDefinition;
isAmbient: boolean;
hasDeclareKeyword: boolean;
Expand Down

0 comments on commit 24d968c

Please sign in to comment.