typescript-to-lua 1.27.1 → 1.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ exports.tryTransformBuiltinGlobalCall = tryTransformBuiltinGlobalCall;
4
4
  const lualib_1 = require("../utils/lualib");
5
5
  const typescript_1 = require("../utils/typescript");
6
6
  const call_1 = require("../visitors/call");
7
+ const string_1 = require("./string");
7
8
  function tryTransformBuiltinGlobalCall(context, node, expressionType) {
8
9
  function getParameters() {
9
10
  const signature = context.checker.getResolvedSignature(node);
@@ -15,6 +16,8 @@ function tryTransformBuiltinGlobalCall(context, node, expressionType) {
15
16
  return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.Symbol, node, ...getParameters());
16
17
  case "NumberConstructor":
17
18
  return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.Number, node, ...getParameters());
19
+ case "StringConstructor":
20
+ return (0, string_1.transformStringConstructorCall)(node, ...getParameters());
18
21
  case "isNaN":
19
22
  case "isFinite":
20
23
  const numberParameters = (0, typescript_1.isNumberType)(context, expressionType)
@@ -90,7 +90,7 @@ function tryTransformBuiltinGlobalMethodCall(context, node, calledMethod) {
90
90
  result = (0, math_1.transformMathCall)(context, node, calledMethod);
91
91
  break;
92
92
  case "StringConstructor":
93
- result = (0, string_1.transformStringConstructorCall)(context, node, calledMethod);
93
+ result = (0, string_1.transformStringConstructorMethodCall)(context, node, calledMethod);
94
94
  break;
95
95
  case "ObjectConstructor":
96
96
  result = (0, object_1.transformObjectConstructorCall)(context, node, calledMethod);
@@ -2,5 +2,6 @@ import * as ts from "typescript";
2
2
  import * as lua from "../../LuaAST";
3
3
  import { TransformationContext } from "../context";
4
4
  export declare function transformStringPrototypeCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
5
- export declare function transformStringConstructorCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
5
+ export declare function transformStringConstructorMethodCall(context: TransformationContext, node: ts.CallExpression, calledMethod: ts.PropertyAccessExpression): lua.Expression | undefined;
6
6
  export declare function transformStringProperty(context: TransformationContext, node: ts.PropertyAccessExpression): lua.Expression | undefined;
7
+ export declare function transformStringConstructorCall(originalNode: ts.CallExpression, ...args: lua.Expression[]): lua.Expression | undefined;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformStringPrototypeCall = transformStringPrototypeCall;
4
- exports.transformStringConstructorCall = transformStringConstructorCall;
4
+ exports.transformStringConstructorMethodCall = transformStringConstructorMethodCall;
5
5
  exports.transformStringProperty = transformStringProperty;
6
+ exports.transformStringConstructorCall = transformStringConstructorCall;
6
7
  const CompilerOptions_1 = require("../../CompilerOptions");
7
8
  const lua = require("../../LuaAST");
8
9
  const diagnostics_1 = require("../utils/diagnostics");
@@ -112,7 +113,7 @@ function transformStringPrototypeCall(context, node, calledMethod) {
112
113
  context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(calledMethod.name, "string", expressionName));
113
114
  }
114
115
  }
115
- function transformStringConstructorCall(context, node, calledMethod) {
116
+ function transformStringConstructorMethodCall(context, node, calledMethod) {
116
117
  const signature = context.checker.getResolvedSignature(node);
117
118
  const params = (0, call_1.transformArguments)(context, node.arguments, signature);
118
119
  const expressionName = calledMethod.name.text;
@@ -138,4 +139,8 @@ function transformStringProperty(context, node) {
138
139
  context.diagnostics.push((0, diagnostics_1.unsupportedProperty)(node.name, "string", node.name.text));
139
140
  }
140
141
  }
142
+ function transformStringConstructorCall(originalNode, ...args) {
143
+ const tostring = lua.createIdentifier("tostring", originalNode.expression);
144
+ return lua.createCallExpression(tostring, args, originalNode);
145
+ }
141
146
  //# sourceMappingURL=string.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-to-lua",
3
- "version": "1.27.1",
3
+ "version": "1.28.1",
4
4
  "description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
5
5
  "repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
6
6
  "homepage": "https://typescripttolua.github.io/",
@@ -42,7 +42,7 @@
42
42
  "node": ">=16.10.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "typescript": "5.6.2"
45
+ "typescript": "5.7.2"
46
46
  },
47
47
  "dependencies": {
48
48
  "@typescript-to-lua/language-extensions": "1.19.0",
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/fs-extra": "^8.1.0",
56
- "@types/glob": "^7.1.1",
56
+ "@types/glob": "^7.2.0",
57
57
  "@types/jest": "^27.5.2",
58
- "@types/node": "^13.7.7",
58
+ "@types/node": "^22.10.0",
59
59
  "@types/picomatch": "^2.3.0",
60
60
  "@types/resolve": "1.14.0",
61
61
  "eslint": "^9.11.0",
@@ -63,13 +63,13 @@
63
63
  "fs-extra": "^8.1.0",
64
64
  "javascript-stringify": "^2.0.1",
65
65
  "jest": "^29.5.0",
66
- "jest-circus": "^29.5.0",
66
+ "jest-circus": "^29.7.0",
67
67
  "lua-types": "^2.13.0",
68
68
  "lua-wasm-bindings": "^0.3.1",
69
69
  "prettier": "^2.8.8",
70
- "ts-jest": "^29.1.0",
71
- "ts-node": "^10.9.1",
72
- "typescript": "^5.6.2",
73
- "typescript-eslint": "^8.7.0"
70
+ "ts-jest": "^29.2.5",
71
+ "ts-node": "^10.9.2",
72
+ "typescript": "5.7.2",
73
+ "typescript-eslint": "^8.16.0"
74
74
  }
75
75
  }