From d47659b48ed272d6bcda9fc0354f025a638ebd9a Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Fri, 27 Jan 2023 10:11:14 +0100 Subject: [PATCH] upgrade to TypeScript 5.0 beta, and unbreak things that broke --- javascript/extractor/lib/typescript/package.json | 4 ++-- javascript/extractor/lib/typescript/src/main.ts | 1 - .../extractor/lib/typescript/src/type_table.ts | 2 +- javascript/extractor/lib/typescript/yarn.lock | 15 ++++++++------- .../ts/extractor/TypeScriptASTConverter.java | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/javascript/extractor/lib/typescript/package.json b/javascript/extractor/lib/typescript/package.json index 87c37660479..461b0e0c516 100644 --- a/javascript/extractor/lib/typescript/package.json +++ b/javascript/extractor/lib/typescript/package.json @@ -2,7 +2,7 @@ "name": "typescript-parser-wrapper", "private": true, "dependencies": { - "typescript": "4.9.3" + "typescript": "5.0.0-beta" }, "scripts": { "build": "tsc --project tsconfig.json", @@ -12,6 +12,6 @@ "watch": "tsc -p . -w --sourceMap" }, "devDependencies": { - "@types/node": "12.7.11" + "@types/node": "18.11.18" } } diff --git a/javascript/extractor/lib/typescript/src/main.ts b/javascript/extractor/lib/typescript/src/main.ts index 0116421a217..2e9f26b6953 100644 --- a/javascript/extractor/lib/typescript/src/main.ts +++ b/javascript/extractor/lib/typescript/src/main.ts @@ -242,7 +242,6 @@ const astProperties: string[] = [ "constructor", "declarationList", "declarations", - "illegalDecorators", "default", "delete", "dotDotDotToken", diff --git a/javascript/extractor/lib/typescript/src/type_table.ts b/javascript/extractor/lib/typescript/src/type_table.ts index 9a14db84019..cae9a19dcd9 100644 --- a/javascript/extractor/lib/typescript/src/type_table.ts +++ b/javascript/extractor/lib/typescript/src/type_table.ts @@ -947,7 +947,7 @@ export class TypeTable { * Returns a unique string for the given call/constructor signature. */ private getSignatureString(kind: ts.SignatureKind, signature: AugmentedSignature): string { - let modifiers = signature.getDeclaration()?.modifiers; + let modifiers = signature.getDeclaration() ? ts.getModifiers(signature.getDeclaration() as ts.MethodSignature) : []; let isAbstract = modifiers && modifiers.filter(modifier => modifier.kind == ts.SyntaxKind.AbstractKeyword).length > 0 let parameters = signature.getParameters(); diff --git a/javascript/extractor/lib/typescript/yarn.lock b/javascript/extractor/lib/typescript/yarn.lock index 03b6581fadb..a4f6befac6b 100644 --- a/javascript/extractor/lib/typescript/yarn.lock +++ b/javascript/extractor/lib/typescript/yarn.lock @@ -2,11 +2,12 @@ # yarn lockfile v1 -"@types/node@12.7.11": - version "12.7.11" - resolved node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446 +"@types/node@18.11.18": + version "18.11.18" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" + integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== -typescript@4.9.3: - version "4.9.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" - integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== +typescript@5.0.0-beta: + version "5.0.0-beta" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.0-beta.tgz#791fa95411d6ff64ee77d677ed1e6f32a2eaabaf" + integrity sha512-+SSabbSXG5mtF+QGdV9uXXt9Saq1cSyI6hSG7znhaLoquleJpnmfkwSxFngK9c2fWWi1W/263TuzXQOsIcdjjA== diff --git a/javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java b/javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java index b0efdcf4b79..e34d552b777 100644 --- a/javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java +++ b/javascript/extractor/src/com/semmle/ts/extractor/TypeScriptASTConverter.java @@ -1159,7 +1159,7 @@ public class TypeScriptASTConverter { loc, hasModifier(node, "ConstKeyword"), hasModifier(node, "DeclareKeyword"), - convertChildrenNotNull(node, "illegalDecorators"), // as of https://github.com/microsoft/TypeScript/pull/50343/ the property is called `illegalDecorators` instead of `decorators` + getDecorators(node), convertChild(node, "name"), convertChildren(node, "members")); attachSymbolInformation(enumDeclaration, node);