Skip to content

Update for typescript v3.1.x #824

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

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"progress": "^2.0.0",
"shelljs": "^0.8.1",
"typedoc-default-themes": "^0.5.0",
"typescript": "2.7.2"
"typescript": "^3.1.0-dev.20180802"
},
"devDependencies": {
"@types/mocha": "2.2.48",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/converter/factories/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const nonStaticKinds = [
* @param name The desired name of the reflection.
* @returns The resulting reflection.
*/
export function createDeclaration(context: Context, node: ts.Node, kind: ReflectionKind, name?: string): DeclarationReflection {
export function createDeclaration(context: Context, node: ts.Declaration, kind: ReflectionKind, name?: string): DeclarationReflection {
const container = <ContainerReflection> context.scope;
if (!(container instanceof ContainerReflection)) {
throw new Error('Expected container reflection.');
Expand Down Expand Up @@ -54,7 +54,7 @@ export function createDeclaration(context: Context, node: ts.Node, kind: Reflect
if (kind === ReflectionKind.ExternalModule) {
isExported = true; // Always mark external modules as exported
} else if (node.parent && node.parent.kind === ts.SyntaxKind.VariableDeclarationList) {
const parentModifiers = ts.getCombinedModifierFlags(node.parent.parent);
const parentModifiers = ts.getCombinedModifierFlags(node.parent.parent as ts.Declaration);
isExported = isExported || !!(parentModifiers & ts.ModifierFlags.Export);
} else {
isExported = isExported || !!(modifiers & ts.ModifierFlags.Export);
Expand Down Expand Up @@ -127,7 +127,7 @@ export function createDeclaration(context: Context, node: ts.Node, kind: Reflect
* @param node The TypeScript node whose properties should be applies to the given reflection.
* @returns The reflection populated with the values of the given node.
*/
function setupDeclaration(context: Context, reflection: DeclarationReflection, node: ts.Node) {
function setupDeclaration(context: Context, reflection: DeclarationReflection, node: ts.Declaration) {
const modifiers = ts.getCombinedModifierFlags(node);

reflection.setFlag(ReflectionFlag.External, context.isExternal);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/nodes/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class ClassConverter extends ConverterNodeComponent<ts.ClassDeclaration>
});
}

const baseType = _ts.getClassExtendsHeritageClauseElement(node);
const baseType = _ts.getEffectiveBaseTypeNode(node);
if (baseType) {
const type = context.getTypeAtLocation(baseType);
if (!context.isInherit) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/nodes/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class FunctionConverter extends ConverterNodeComponent<ts.FunctionDeclara
const scope = context.scope;
const kind = scope.kind & ReflectionKind.ClassOrInterface ? ReflectionKind.Method : ReflectionKind.Function;
const hasBody = !!node.body;
const method = createDeclaration(context, <ts.Node> node, kind);
const method = createDeclaration(context, node, kind);

if (method // child inheriting will return null on createDeclaration
&& kind & ReflectionKind.Method
Expand Down
6 changes: 3 additions & 3 deletions src/lib/ts-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export function isBindingPattern(node: ts.Node): node is ts.BindingPattern {
return tsany.isBindingPattern.apply(this, arguments);
}

// https://github.com/Microsoft/TypeScript/blob/v2.1.4/src/compiler/utilities.ts#L1729
export function getClassExtendsHeritageClauseElement(node: ts.ClassLikeDeclaration | ts.InterfaceDeclaration) {
return tsany.getClassExtendsHeritageClauseElement.apply(this, arguments);
// https://github.com/Microsoft/TypeScript/blob/v3.0.1/src/compiler/utilities.ts#L2408
export function getEffectiveBaseTypeNode(node: ts.ClassLikeDeclaration | ts.InterfaceDeclaration) {
return tsany.getEffectiveBaseTypeNode.apply(this, arguments);
}

// https://github.com/Microsoft/TypeScript/blob/v2.1.4/src/compiler/utilities.ts#L1734
Expand Down