From 1226e56169af916862e9f50e7fe35d6fac96d881 Mon Sep 17 00:00:00 2001 From: Ryan Waskiewicz Date: Tue, 30 Aug 2022 15:19:44 -0400 Subject: [PATCH] feat(typescript): add support for typescript v4.7 (#3530) this pr adds support through v4.7.4 of typescript. to support v4.6 and v4.7, minor changes were required for each: - to add support for TypeScript 4.6, the `lib` fields of a few `tsconfig.json` files needed to be updated to continue to support `Array.prototype.flat()`. TS no longer bundles `flat` in `esnext.array`, but does in `es2019`. as a result, the former value was removed, while `es2017` was bumped to `es2019` - to add support for TypeScript v4.7, `Performance` gained the `EventCount` field, which was added to `MockPerformance` to adhere to that interface. STENCIL-435: Upgrade TypeScript to v4.7 --- package-lock.json | 14 +++++++------- package.json | 2 +- scripts/tsconfig.json | 3 +-- src/compiler/sys/dependencies.json | 9 +++++++++ src/mock-doc/performance.ts | 2 ++ tsconfig.json | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9b2c65ec69a..19cbb802573 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,7 +84,7 @@ "semver": "7.3.4", "sizzle": "^2.3.6", "terser": "5.6.1", - "typescript": "4.5.4", + "typescript": "4.7.4", "webpack": "^4.46.0", "ws": "7.4.6" }, @@ -12387,9 +12387,9 @@ } }, "node_modules/typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -23075,9 +23075,9 @@ } }, "typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 914052365cd..ef52df06470 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "semver": "7.3.4", "sizzle": "^2.3.6", "terser": "5.6.1", - "typescript": "4.5.4", + "typescript": "4.7.4", "webpack": "^4.46.0", "ws": "7.4.6" }, diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index db36314866a..ed75305782d 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -6,8 +6,7 @@ "forceConsistentCasingInFileNames": true, "lib": [ "dom", - "es2017", - "esnext.array" + "es2019", ], "module": "commonjs", "moduleResolution": "node", diff --git a/src/compiler/sys/dependencies.json b/src/compiler/sys/dependencies.json index d7f12642ed4..6a164fd7d84 100644 --- a/src/compiler/sys/dependencies.json +++ b/src/compiler/sys/dependencies.json @@ -44,8 +44,10 @@ "compiler/lib.es2019.symbol.d.ts", "compiler/lib.es2020.bigint.d.ts", "compiler/lib.es2020.d.ts", + "compiler/lib.es2020.date.d.ts", "compiler/lib.es2020.full.d.ts", "compiler/lib.es2020.intl.d.ts", + "compiler/lib.es2020.number.d.ts", "compiler/lib.es2020.promise.d.ts", "compiler/lib.es2020.sharedmemory.d.ts", "compiler/lib.es2020.string.d.ts", @@ -56,6 +58,13 @@ "compiler/lib.es2021.promise.d.ts", "compiler/lib.es2021.string.d.ts", "compiler/lib.es2021.weakref.d.ts", + "compiler/lib.es2022.array.d.ts", + "compiler/lib.es2022.d.ts", + "compiler/lib.es2022.error.d.ts", + "compiler/lib.es2022.full.d.ts", + "compiler/lib.es2022.intl.d.ts", + "compiler/lib.es2022.object.d.ts", + "compiler/lib.es2022.string.d.ts", "compiler/lib.es5.d.ts", "compiler/lib.es6.d.ts", "compiler/lib.esnext.d.ts", diff --git a/src/mock-doc/performance.ts b/src/mock-doc/performance.ts index 3fc60be76de..c895945817a 100644 --- a/src/mock-doc/performance.ts +++ b/src/mock-doc/performance.ts @@ -3,9 +3,11 @@ */ export class MockPerformance implements Performance { timeOrigin: number; + eventCounts: EventCounts; constructor() { this.timeOrigin = Date.now(); + this.eventCounts = new Map(); } addEventListener() { diff --git a/tsconfig.json b/tsconfig.json index ecf6c1093ae..214e806a29b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ "jsx": "react", "jsxFactory": "h", "jsxFragmentFactory": "Fragment", - "lib": ["dom", "es2018", "esnext.array"], + "lib": ["dom", "es2019"], "module": "esnext", "moduleResolution": "node", "noImplicitAny": true,