Skip to content

Commit f01403f

Browse files
authored
Upgrade TS to 5.1.3 (#1452)
* Tests for new decorators * Rename old decorate function to DecorateLegacy * Method decorators and partially accessor decorators rewritten * Modern decorators except field decorators working but with some regression to legacy * All decorators legacy and modern work, except for field decorators * Finalize property decorators * Fix unit tests * Upgrade TS to 5.1.3
1 parent a2ee2f7 commit f01403f

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"node": ">=16.10.0"
4343
},
4444
"peerDependencies": {
45-
"typescript": "^5.0.2"
45+
"typescript": "~5.1.3"
4646
},
4747
"dependencies": {
4848
"@typescript-to-lua/language-extensions": "1.0.0",
@@ -70,6 +70,6 @@
7070
"prettier": "^2.8.4",
7171
"ts-jest": "^29.1.0",
7272
"ts-node": "^10.9.1",
73-
"typescript": "^5.0.4"
73+
"typescript": "~5.1.3"
7474
}
7575
}

src/transformation/utils/function-context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function hasNoSelfAncestor(declaration: ts.Declaration): boolean {
3030

3131
function getExplicitThisParameter(signatureDeclaration: ts.SignatureDeclaration): ts.ParameterDeclaration | undefined {
3232
const param = signatureDeclaration.parameters[0];
33-
if (param && ts.isIdentifier(param.name) && param.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword) {
33+
if (param && ts.isIdentifier(param.name) && ts.identifierToKeywordKind(param.name) === ts.SyntaxKind.ThisKeyword) {
3434
return param;
3535
}
3636
}

src/transformation/visitors/function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export function transformParameters(
195195

196196
// Only push parameter name to paramName array if it isn't a spread parameter
197197
for (const param of parameters) {
198-
if (ts.isIdentifier(param.name) && param.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword) {
198+
if (ts.isIdentifier(param.name) && ts.identifierToKeywordKind(param.name) === ts.SyntaxKind.ThisKeyword) {
199199
continue;
200200
}
201201

src/transformation/visitors/identifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function transformIdentifierWithSymbol(
8585
}
8686

8787
export const transformIdentifierExpression: FunctionVisitor<ts.Identifier> = (node, context) => {
88-
if (node.originalKeywordKind === ts.SyntaxKind.UndefinedKeyword) {
88+
if (ts.identifierToKeywordKind(node) === ts.SyntaxKind.UndefinedKeyword) {
8989
return lua.createNilLiteral(node);
9090
}
9191

src/transformation/visitors/modules/export.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ function transformExportAll(context: TransformationContext, node: ts.ExportDecla
105105
}
106106

107107
const isDefaultExportSpecifier = (node: ts.ExportSpecifier) =>
108-
(node.name && node.name.originalKeywordKind === ts.SyntaxKind.DefaultKeyword) ||
109-
(node.propertyName && node.propertyName.originalKeywordKind === ts.SyntaxKind.DefaultKeyword);
108+
(node.name && ts.identifierToKeywordKind(node.name) === ts.SyntaxKind.DefaultKeyword) ||
109+
(node.propertyName && ts.identifierToKeywordKind(node.propertyName) === ts.SyntaxKind.DefaultKeyword);
110110

111111
function transformExportSpecifier(context: TransformationContext, node: ts.ExportSpecifier): lua.AssignmentStatement {
112112
const exportedSymbol = context.checker.getExportSpecifierLocalTargetSymbol(node);

0 commit comments

Comments
 (0)