Skip to content

Commit

Permalink
Bump typescript to 4.9.3 (#15202)
Browse files Browse the repository at this point in the history
* bump typescript to 4.9.3

* fix typing errors
  • Loading branch information
JLHwung committed Nov 17, 2022
1 parent 4dedd57 commit f6546d7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -73,7 +73,7 @@
"shelljs": "^0.8.5",
"test262-stream": "^1.4.0",
"through2": "^4.0.0",
"typescript": "~4.8.3"
"typescript": "~4.9.3"
},
"workspaces": [
"codemods/*",
Expand Down
19 changes: 16 additions & 3 deletions packages/babel-core/src/config/validation/option-assertions.ts
Expand Up @@ -85,6 +85,7 @@ export function assertRootMode(
`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`,
);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand All @@ -102,6 +103,7 @@ export function assertSourceMaps(
`${msg(loc)} must be a boolean, "inline", "both", or undefined`,
);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand All @@ -112,6 +114,7 @@ export function assertCompact(
if (value !== undefined && typeof value !== "boolean" && value !== "auto") {
throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand All @@ -129,6 +132,7 @@ export function assertSourceType(
`${msg(loc)} must be "module", "script", "unambiguous", or undefined`,
);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand Down Expand Up @@ -186,6 +190,7 @@ export function assertString(loc: GeneralPath, value: unknown): string | void {
if (value !== undefined && typeof value !== "string") {
throw new Error(`${msg(loc)} must be a string, or undefined`);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand All @@ -196,6 +201,7 @@ export function assertFunction(
if (value !== undefined && typeof value !== "function") {
throw new Error(`${msg(loc)} must be a function, or undefined`);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand All @@ -206,6 +212,7 @@ export function assertBoolean(
if (value !== undefined && typeof value !== "boolean") {
throw new Error(`${msg(loc)} must be a boolean, or undefined`);
}
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

Expand Down Expand Up @@ -263,7 +270,10 @@ export function assertConfigApplicableTest(
loc: OptionPath,
value: unknown,
): ConfigApplicableTest | void {
if (value === undefined) return value;
if (value === undefined) {
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

if (Array.isArray(value)) {
value.forEach((item, i) => {
Expand Down Expand Up @@ -303,15 +313,18 @@ export function assertConfigFileSearch(
`got ${JSON.stringify(value)}`,
);
}

// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

export function assertBabelrcSearch(
loc: OptionPath,
value: unknown,
): BabelrcSearch | void {
if (value === undefined || typeof value === "boolean") return value;
if (value === undefined || typeof value === "boolean") {
// @ts-expect-error: TS can only narrow down the type when "strictNullCheck" is true
return value;
}

if (Array.isArray(value)) {
value.forEach((item, i) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-parser/src/parse-error.ts
Expand Up @@ -47,7 +47,7 @@ export type ParseErrorConstructor<ErrorDetails> = (a: {
details: ErrorDetails;
}) => ParseError<ErrorDetails>;

function toParseErrorConstructor<ErrorDetails>({
function toParseErrorConstructor<ErrorDetails extends object>({
toMessage,
...properties
}: ParseErrorCredentials<ErrorDetails>): ParseErrorConstructor<ErrorDetails> {
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Expand Up @@ -5971,7 +5971,7 @@ __metadata:
shelljs: ^0.8.5
test262-stream: ^1.4.0
through2: ^4.0.0
typescript: ~4.8.3
typescript: ~4.9.3
dependenciesMeta:
core-js:
built: false
Expand Down Expand Up @@ -14707,23 +14707,23 @@ fsevents@^1.2.7:
languageName: node
linkType: hard

"typescript@npm:~4.8.3":
version: 4.8.4
resolution: "typescript@npm:4.8.4"
"typescript@npm:~4.9.3":
version: 4.9.3
resolution: "typescript@npm:4.9.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 3e4f061658e0c8f36c820802fa809e0fd812b85687a9a2f5430bc3d0368e37d1c9605c3ce9b39df9a05af2ece67b1d844f9f6ea8ff42819f13bcb80f85629af0
checksum: 17b8f816050b412403e38d48eef0e893deb6be522d6dc7caf105e54a72e34daf6835c447735fd2b28b66784e72bfbf87f627abb4818a8e43d1fa8106396128dc
languageName: node
linkType: hard

"typescript@patch:typescript@~4.8.3#~builtin<compat/typescript>":
version: 4.8.4
resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin<compat/typescript>::version=4.8.4&hash=701156"
"typescript@patch:typescript@~4.9.3#~builtin<compat/typescript>":
version: 4.9.3
resolution: "typescript@patch:typescript@npm%3A4.9.3#~builtin<compat/typescript>::version=4.9.3&hash=701156"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 301459fc3eb3b1a38fe91bf96d98eb55da88a9cb17b4ef80b4d105d620f4d547ba776cc27b44cc2ef58b66eda23fe0a74142feb5e79a6fb99f54fc018a696afa
checksum: ef65c22622d864497d0a0c5db693523329b3284c15fe632e93ad9aa059e8dc38ef3bd767d6f26b1e5ecf9446f49bd0f6c4e5714a2eeaf352805dc002479843d1
languageName: node
linkType: hard

Expand Down

0 comments on commit f6546d7

Please sign in to comment.