Skip to content

Commit 9e37de6

Browse files
authored
update TypeScript to 5.9.3 (#1669)
1 parent 1ed3b4d commit 9e37de6

File tree

9 files changed

+304
-303
lines changed

9 files changed

+304
-303
lines changed

package-lock.json

Lines changed: 292 additions & 277 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"node": ">=16.10.0"
4343
},
4444
"peerDependencies": {
45-
"typescript": "5.8.2"
45+
"typescript": "5.9.3"
4646
},
4747
"dependencies": {
4848
"@typescript-to-lua/language-extensions": "1.19.0",
@@ -69,7 +69,7 @@
6969
"prettier": "^2.8.8",
7070
"ts-jest": "^29.2.5",
7171
"ts-node": "^10.9.2",
72-
"typescript": "5.8.2",
73-
"typescript-eslint": "^8.26.0"
72+
"typescript": "5.9.3",
73+
"typescript-eslint": "^8.46.3"
7474
}
7575
}

src/lualib/SourceMapTraceBack.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ interface SourceMap {
99

1010
declare global {
1111
function __TS__originalTraceback(this: void, thread?: LuaThread, message?: string, level?: number): void;
12-
// eslint-disable-next-line no-var
1312
var __TS__sourcemap: Record<string, SourceMap>;
1413
}
1514

src/lualib/StringSplit.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const sub = string.sub;
22
const find = string.find;
33
export function __TS__StringSplit(this: void, source: string, separator?: string, limit?: number): string[] {
4-
if (limit === undefined) {
5-
limit = 4294967295;
6-
}
4+
limit ??= 4294967295;
75

86
if (limit === 0) {
97
return [];

src/transformation/utils/scope.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ export function markSymbolAsReferencedInCurrentScopes(
6060
identifier: ts.Identifier
6161
): void {
6262
for (const scope of context.scopeStack) {
63-
if (!scope.referencedSymbols) {
64-
scope.referencedSymbols = new Map();
65-
}
63+
scope.referencedSymbols ??= new Map();
6664

6765
const references = getOrUpdate(scope.referencedSymbols, symbolId, () => []);
6866
references.push(identifier);
@@ -87,9 +85,8 @@ export function findScope(context: TransformationContext, scopeTypes: ScopeType)
8785
}
8886

8987
export function addScopeVariableDeclaration(scope: Scope, declaration: lua.VariableDeclarationStatement) {
90-
if (!scope.variableDeclarations) {
91-
scope.variableDeclarations = [];
92-
}
88+
scope.variableDeclarations ??= [];
89+
9390
scope.variableDeclarations.push(declaration);
9491
}
9592

src/transformation/visitors/class/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,8 @@ export const transformSuperExpression: FunctionVisitor<ts.SuperExpression> = (ex
272272
}
273273
}
274274

275-
if (!baseClassName) {
276-
// Use "className.____super" if the base is not a simple identifier
277-
baseClassName = lua.createTableIndexExpression(className, lua.createStringLiteral("____super"), expression);
278-
}
275+
// Use "className.____super" if the base is not a simple identifier
276+
baseClassName ??= lua.createTableIndexExpression(className, lua.createStringLiteral("____super"), expression);
279277

280278
const f = findFirstNodeAbove(expression, ts.isFunctionLike);
281279
if (f && ts.canHaveModifiers(f) && isStaticNode(f)) {

src/transformation/visitors/enum.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ export const transformEnumDeclaration: FunctionVisitor<ts.EnumDeclaration> = (no
6060
}
6161
}
6262

63-
if (!valueExpression) {
64-
valueExpression = context.transformExpression(member.initializer);
65-
}
63+
valueExpression ??= context.transformExpression(member.initializer);
6664
} else {
6765
valueExpression = lua.createNilLiteral();
6866
}

src/transformation/visitors/function.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,7 @@ export const transformFunctionDeclaration: FunctionVisitor<ts.FunctionDeclaratio
343343
// Remember symbols referenced in this function for hoisting later
344344
if (name.symbolId !== undefined) {
345345
const scope = peekScope(context);
346-
if (!scope.functionDefinitions) {
347-
scope.functionDefinitions = new Map();
348-
}
346+
scope.functionDefinitions ??= new Map();
349347

350348
const functionInfo = { referencedSymbols: functionScope.referencedSymbols ?? new Map() };
351349
scope.functionDefinitions.set(name.symbolId, functionInfo);

src/transformation/visitors/modules/import.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ function transformImportSpecifier(
6666
export const transformImportDeclaration: FunctionVisitor<ts.ImportDeclaration> = (statement, context) => {
6767
const scope = peekScope(context);
6868

69-
if (!scope.importStatements) {
70-
scope.importStatements = [];
71-
}
69+
scope.importStatements ??= [];
7270

7371
const result: lua.Statement[] = [];
7472
const requireCall = createModuleRequire(context, statement.moduleSpecifier);

0 commit comments

Comments
 (0)