From 0efa8ec920eee5848dc9afb262bff977d0723af8 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 30 Jul 2020 16:17:24 +0200 Subject: [PATCH] fix: add support for TypeScript 4.0 (#4943) Closes #4941 --- package.json | 6 +++--- src/rules/alignRule.ts | 4 +++- src/rules/noRedundantJsdocRule.ts | 2 +- src/rules/oneLineRule.ts | 2 +- yarn.lock | 16 ++++++++-------- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index de899a5617f..3cb3b13c6b6 100644 --- a/package.json +++ b/package.json @@ -40,11 +40,11 @@ "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.10.0", + "tslib": "^1.13.0", "tsutils": "^2.29.0" }, "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" + "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 4.0.0-dev" }, "devDependencies": { "@octokit/rest": "^16.24.3", @@ -73,7 +73,7 @@ "tslint-config-prettier": "^1.18.0", "tslint-plugin-prettier": "^2.0.1", "tslint-test-config-non-relative": "file:test/external/tslint-test-config-non-relative", - "typescript": "~3.8.2", + "typescript": "~4.0.0-beta", "yarn-deduplicate": "^1.1.1" }, "engines": { diff --git a/src/rules/alignRule.ts b/src/rules/alignRule.ts index 36c595f7e83..4bcea581957 100644 --- a/src/rules/alignRule.ts +++ b/src/rules/alignRule.ts @@ -142,7 +142,9 @@ class AlignWalker extends Lint.AbstractWalker { case ts.SyntaxKind.TupleType: if (this.options.elements) { this.checkAlignment( - (node as ts.TupleTypeNode).elementTypes, + // In TS 4 TupleTypeNode.elementTypes has been updated to elements + // tslint:disable-next-line + (node as any).elementTypes || (node as ts.TupleTypeNode).elements, OPTION_ELEMENTS, ); } diff --git a/src/rules/noRedundantJsdocRule.ts b/src/rules/noRedundantJsdocRule.ts index 1ed01ddc32a..d30e4d6ec24 100644 --- a/src/rules/noRedundantJsdocRule.ts +++ b/src/rules/noRedundantJsdocRule.ts @@ -73,7 +73,7 @@ function walk(ctx: Lint.WalkContext): void { ); } break; - + case ts.SyntaxKind.JSDocDeprecatedTag: case ts.SyntaxKind.JSDocAugmentsTag: case ts.SyntaxKind.JSDocAuthorTag: // OK diff --git a/src/rules/oneLineRule.ts b/src/rules/oneLineRule.ts index 02602fabbd1..ef6c4ef7047 100644 --- a/src/rules/oneLineRule.ts +++ b/src/rules/oneLineRule.ts @@ -87,7 +87,7 @@ class OneLineWalker extends Lint.AbstractWalker { if ( !isBlockLike(node.parent) || (node.parent.kind === ts.SyntaxKind.CaseClause && - (node.parent as ts.CaseClause).statements.length === 1) + node.parent.statements.length === 1) ) { this.check({ pos: node.pos, end: (node as ts.Block).statements.pos }); } diff --git a/yarn.lock b/yarn.lock index 03cb4497925..6a8f20e91ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1822,10 +1822,10 @@ tsconfig@^6.0.0: strip-bom "^3.0.0" strip-json-comments "^2.0.0" -tslib@^1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" - integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== +tslib@^1.13.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1: + version "1.13.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" + integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== tslint-config-prettier@^1.18.0: version "1.18.0" @@ -1880,10 +1880,10 @@ type-detect@^1.0.0: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" integrity sha1-diIXzAbbJY7EiQihKY6LlRIejqI= -typescript@~3.8.2: - version "3.8.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a" - integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ== +typescript@~4.0.0-beta: + version "4.0.0-dev.20200730" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.0.0-dev.20200730.tgz#0c1e874cbbfc702c32d9ac261c2f9dc9c37b14c1" + integrity sha512-bqw862eRy5niIZgCJTmn9DqkHTPoCF2eLlLA6jmOvubOgN8BNQrsaf+fE4PQkhzk9ae1/T9iAmDhapgmwWMHIA== uglify-js@^3.1.4: version "3.5.11"