Skip to content

Commit

Permalink
Update typescript to 4.8 (#14880)
Browse files Browse the repository at this point in the history
* remove @babel/parser tsconfig

* update typescript to 4.8

* Fix new typing errors

* test

* Update packages/babel-traverse/src/path/index.ts

Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com>

Co-authored-by: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com>
  • Loading branch information
JLHwung and liuxingbaoyu committed Aug 30, 2022
1 parent 6c5ebd1 commit 2626f18
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -72,7 +72,7 @@
"shelljs": "^0.8.5",
"test262-stream": "^1.4.0",
"through2": "^4.0.0",
"typescript": "~4.7.4"
"typescript": "~4.8.2"
},
"workspaces": [
"codemods/*",
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-core/src/config/caching.ts
Expand Up @@ -395,6 +395,8 @@ export function assertSimpleType(value: unknown): SimpleType {
"Cache keys must be either string, boolean, number, null, or undefined.",
);
}
// @ts-expect-error Type 'unknown' is not assignable to type 'SimpleType'. This can be removed
// when strictNullCheck is enabled
return value;
}

Expand Down
4 changes: 3 additions & 1 deletion packages/babel-core/src/config/helpers/deep-array.ts
Expand Up @@ -10,7 +10,9 @@ export function finalize<T>(deepArr: DeepArray<T>): ReadonlyDeepArray<T> {
return Object.freeze(deepArr) as ReadonlyDeepArray<T>;
}

export function flattenToSet<T>(arr: ReadonlyDeepArray<T>): Set<T> {
export function flattenToSet<T extends string>(
arr: ReadonlyDeepArray<T>,
): Set<T> {
const result = new Set<T>();
const stack = [arr];
while (stack.length > 0) {
Expand Down
7 changes: 0 additions & 7 deletions packages/babel-parser/tsconfig.json

This file was deleted.

8 changes: 7 additions & 1 deletion packages/babel-traverse/src/path/index.ts
Expand Up @@ -109,7 +109,13 @@ class NodePath<T extends t.Node = t.Node> {
}

getScope(scope: Scope): Scope {
return this.isScope() ? new Scope(this) : scope;
// TODO: Remove this when TS is fixed.
// A regression was introduced in ts4.8 that would cause OOM.
// Avoid it by manually casting the types.
// https://github.com/babel/babel/pull/14880
return this.isScope()
? new Scope(this as NodePath<t.Pattern | t.Scopable>)
: scope;
}

setData(key: string | symbol, val: any): any {
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Expand Up @@ -5961,7 +5961,7 @@ __metadata:
shelljs: ^0.8.5
test262-stream: ^1.4.0
through2: ^4.0.0
typescript: ~4.7.4
typescript: ~4.8.2
dependenciesMeta:
core-js:
built: false
Expand Down Expand Up @@ -14759,23 +14759,23 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"typescript@npm:~4.7.4":
version: 4.7.4
resolution: "typescript@npm:4.7.4"
"typescript@npm:~4.8.2":
version: 4.8.2
resolution: "typescript@npm:4.8.2"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 5750181b1cd7e6482c4195825547e70f944114fb47e58e4aa7553e62f11b3f3173766aef9c281783edfd881f7b8299cf35e3ca8caebe73d8464528c907a164df
checksum: 7f5b81d0d558c9067f952c7af52ab7f19c2e70a916817929e4a5b256c93990bf3178eccb1ac8a850bc75df35f6781b6f4cb3370ce20d8b1ded92ed462348f628
languageName: node
linkType: hard

"typescript@patch:typescript@~4.7.4#~builtin<compat/typescript>":
version: 4.7.4
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=493e53"
"typescript@patch:typescript@~4.8.2#~builtin<compat/typescript>":
version: 4.8.2
resolution: "typescript@patch:typescript@npm%3A4.8.2#~builtin<compat/typescript>::version=4.8.2&hash=493e53"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 96d3030cb01143570567cb4f3a616b10df65f658f0e74e853e77a089a6a954e35c800be7db8b9bfe9a1ae05d9c2897e281359f65e4caa1caf266368e1c4febd3
checksum: 6f49363af8af2fe480da1d5fa68712644438785208b06690a3cbe5e7365fd652c3a0f1e587bc8684d78fb69de3dde4de185c0bad7bb4f3664ddfc813ce8caad6
languageName: node
linkType: hard

Expand Down

0 comments on commit 2626f18

Please sign in to comment.