Skip to content

Commit 424fc90

Browse files
Update to TypeScript 5.5 (#16536)
Co-authored-by: Babel Bot <30521560+liuxingbaoyu@users.noreply.github.com>
1 parent 5ed73df commit 424fc90

15 files changed

Lines changed: 59 additions & 43 deletions

File tree

babel.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ function pluginImportMetaUrl({ types: t, template }) {
935935
};
936936
}
937937

938+
/** @returns {import("@babel/core").PluginObj} */
938939
function pluginReplaceTSImportExtension() {
939940
return {
940941
visitor: {
@@ -945,7 +946,9 @@ function pluginReplaceTSImportExtension() {
945946
}
946947
},
947948
TSImportEqualsDeclaration({ node }) {
948-
const { expression } = node.moduleReference;
949+
const { moduleReference } = node;
950+
if (moduleReference.type !== "TSExternalModuleReference") return;
951+
const { expression } = moduleReference;
949952
expression.value = expression.value.replace(/(\.[mc]?)ts$/, "$1js");
950953
},
951954
},

eslint/babel-eslint-parser/src/experimental-worker.cts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import normalizeESLintConfig = require("./configuration.cts");
1010
import analyzeScope = require("./analyze-scope.cts");
1111
import baseParse = require("./parse.cts");
1212

13-
import { WorkerClient } from "./client.cts";
13+
import Clients = require("./client.cts");
1414

15-
const client = new WorkerClient();
15+
const client = new Clients.WorkerClient();
1616

1717
export const meta = {
1818
name: "@babel/eslint-parser/experimental-worker",

eslint/babel-eslint-parser/src/worker/handle-message.cts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import babel = require("./babel-core.cts");
22
import maybeParse = require("./maybeParse.cts");
3-
import { getVisitorKeys, getTokLabels } from "./ast-info.cts";
4-
import {
5-
normalizeBabelParseConfig,
6-
normalizeBabelParseConfigSync,
7-
} from "./configuration.cts";
3+
import astInfo = require("./ast-info.cts");
4+
import config = require("./configuration.cts");
85

9-
import { ACTIONS } from "../client.cts";
6+
import Clients = require("../client.cts");
7+
import ACTIONS = Clients.ACTIONS;
108

119
export = function handleMessage(action: ACTIONS, payload: any) {
1210
switch (action) {
@@ -18,18 +16,18 @@ export = function handleMessage(action: ACTIONS, payload: any) {
1816
VISITOR_KEYS: babel.types.VISITOR_KEYS,
1917
};
2018
case ACTIONS.GET_TOKEN_LABELS:
21-
return getTokLabels();
19+
return astInfo.getTokLabels();
2220
case ACTIONS.GET_VISITOR_KEYS:
23-
return getVisitorKeys();
21+
return astInfo.getVisitorKeys();
2422
case ACTIONS.MAYBE_PARSE:
25-
return normalizeBabelParseConfig(payload.options).then(options =>
26-
maybeParse(payload.code, options),
27-
);
23+
return config
24+
.normalizeBabelParseConfig(payload.options)
25+
.then(options => maybeParse(payload.code, options));
2826
case ACTIONS.MAYBE_PARSE_SYNC:
2927
if (!USE_ESM) {
3028
return maybeParse(
3129
payload.code,
32-
normalizeBabelParseConfigSync(payload.options),
30+
config.normalizeBabelParseConfigSync(payload.options),
3331
);
3432
}
3533
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"semver": "^6.3.1",
8282
"shelljs": "^0.8.5",
8383
"test262-stream": "^1.4.0",
84-
"typescript": "^5.4.5",
84+
"typescript": "5.5.1-rc",
8585
"typescript-eslint": "^7.8.0"
8686
},
8787
"workspaces": [

packages/babel-cli/src/babel/options.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ export default function parseArgv(args: Array<string>): CmdOptions | null {
221221
? // glob 9+ no longer sorts the result, here we maintain the glob 7 behaviour
222222
// https://github.com/isaacs/node-glob/blob/c3cd57ae128faa0e9190492acc743bb779ac4054/common.js#L151
223223
glob.sync(input, { dotRelative: true }).sort(alphasort)
224-
: // @ts-expect-error When USE_ESM is true and BABEL_8_BREAKING is off,
225-
// the glob package is an ESM wrapper of the CJS glob 7
226-
(USE_ESM ? glob.default.sync : glob.sync)(input);
224+
: (USE_ESM ? glob.default.sync : glob.sync)(input);
227225
if (!files.length) files = [input];
228226
globbed.push(...files);
229227
return globbed;

packages/babel-helpers/scripts/generate-regenerator-runtime.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable import/no-extraneous-dependencies */
2-
31
import fs from "fs";
42
import { createRequire } from "module";
53

packages/babel-parser/src/parser/expression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2637,7 +2637,7 @@ export default abstract class ExpressionParser extends LValParser {
26372637
this.expressionScope.exit();
26382638
}
26392639

2640-
isSimpleParameter(node: N.Pattern | N.TSParameterProperty) {
2640+
isSimpleParameter(node: N.Pattern | N.TSParameterProperty): boolean {
26412641
return node.type === "Identifier";
26422642
}
26432643

packages/babel-parser/src/parser/lval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ export default abstract class LValParser extends NodeUtils {
559559
}
560560

561561
// Overridden by the estree plugin
562-
isOptionalMemberExpression(expression: Node) {
562+
isOptionalMemberExpression(expression: Node): boolean {
563563
return expression.type === "OptionalMemberExpression";
564564
}
565565

packages/babel-parser/src/plugins/typescript/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2338,7 +2338,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
23382338
return elt;
23392339
}
23402340

2341-
isSimpleParameter(node: N.Pattern | N.TSParameterProperty) {
2341+
isSimpleParameter(node: N.Pattern | N.TSParameterProperty): boolean {
23422342
return (
23432343
(node.type === "TSParameterProperty" &&
23442344
super.isSimpleParameter(node.parameter)) ||

packages/babel-standalone/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{
33
"extends": [
44
"../../tsconfig.base.json",
5-
"../../tsconfig.paths.json"
5+
"../../tsconfig.paths.json",
6+
"./tsconfig.overrides.json"
67
],
78
"include": [
89
"../../packages/babel-standalone/src/**/*.ts",

0 commit comments

Comments
 (0)