@player-tools/xlr-converters 0.3.0 → 0.4.0--canary.25.709
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.
- package/dist/index.cjs.js +1 -10
- package/dist/index.esm.js +1 -10
- package/package.json +4 -3
- package/src/ts-to-xlr.ts +1 -19
package/dist/index.cjs.js
CHANGED
|
@@ -120,9 +120,6 @@ class TsConverter {
|
|
|
120
120
|
} else {
|
|
121
121
|
resultingNode = this.tsLiteralToType(variable.initializer);
|
|
122
122
|
}
|
|
123
|
-
if (resultingNode.type === "function" || resultingNode.type === "ref") {
|
|
124
|
-
resultingNode = __spreadProps(__spreadValues$1({}, resultingNode), { name: variable.name.getText() });
|
|
125
|
-
}
|
|
126
123
|
return __spreadValues$1({
|
|
127
124
|
name: variable.name.getText()
|
|
128
125
|
}, resultingNode);
|
|
@@ -415,13 +412,7 @@ class TsConverter {
|
|
|
415
412
|
}
|
|
416
413
|
}
|
|
417
414
|
const functionReturnType = this.context.typeChecker.getTypeAtLocation(functionCall);
|
|
418
|
-
|
|
419
|
-
if (ts__default["default"].isArrowFunction(functionCall)) {
|
|
420
|
-
const syntheticWithParameters = __spreadProps(__spreadValues$1({}, syntheticNode), {
|
|
421
|
-
parameters: functionCall.parameters
|
|
422
|
-
});
|
|
423
|
-
syntheticNode = syntheticWithParameters;
|
|
424
|
-
}
|
|
415
|
+
const syntheticNode = this.context.typeChecker.typeToTypeNode(functionReturnType, document, void 0);
|
|
425
416
|
if (syntheticNode) {
|
|
426
417
|
if (ts__default["default"].isTypeReferenceNode(syntheticNode) && ts__default["default"].isIdentifier(syntheticNode.typeName)) {
|
|
427
418
|
const { typeName } = syntheticNode;
|
package/dist/index.esm.js
CHANGED
|
@@ -112,9 +112,6 @@ class TsConverter {
|
|
|
112
112
|
} else {
|
|
113
113
|
resultingNode = this.tsLiteralToType(variable.initializer);
|
|
114
114
|
}
|
|
115
|
-
if (resultingNode.type === "function" || resultingNode.type === "ref") {
|
|
116
|
-
resultingNode = __spreadProps(__spreadValues$1({}, resultingNode), { name: variable.name.getText() });
|
|
117
|
-
}
|
|
118
115
|
return __spreadValues$1({
|
|
119
116
|
name: variable.name.getText()
|
|
120
117
|
}, resultingNode);
|
|
@@ -407,13 +404,7 @@ class TsConverter {
|
|
|
407
404
|
}
|
|
408
405
|
}
|
|
409
406
|
const functionReturnType = this.context.typeChecker.getTypeAtLocation(functionCall);
|
|
410
|
-
|
|
411
|
-
if (ts.isArrowFunction(functionCall)) {
|
|
412
|
-
const syntheticWithParameters = __spreadProps(__spreadValues$1({}, syntheticNode), {
|
|
413
|
-
parameters: functionCall.parameters
|
|
414
|
-
});
|
|
415
|
-
syntheticNode = syntheticWithParameters;
|
|
416
|
-
}
|
|
407
|
+
const syntheticNode = this.context.typeChecker.typeToTypeNode(functionReturnType, document, void 0);
|
|
417
408
|
if (syntheticNode) {
|
|
418
409
|
if (ts.isTypeReferenceNode(syntheticNode) && ts.isIdentifier(syntheticNode.typeName)) {
|
|
419
410
|
const { typeName } = syntheticNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-tools/xlr-converters",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0--canary.25.709",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
"typescript": "4.8.4"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@player-tools/xlr": "0.
|
|
13
|
-
"@player-tools/xlr-utils": "0.
|
|
12
|
+
"@player-tools/xlr": "0.4.0--canary.25.709",
|
|
13
|
+
"@player-tools/xlr-utils": "0.4.0--canary.25.709",
|
|
14
|
+
"@typescript/vfs": "^1.4.0",
|
|
14
15
|
"@babel/runtime": "7.15.4"
|
|
15
16
|
},
|
|
16
17
|
"main": "dist/index.cjs.js",
|
package/src/ts-to-xlr.ts
CHANGED
|
@@ -177,7 +177,6 @@ export class TsConverter {
|
|
|
177
177
|
const variableDeclarations = node.declarationList.declarations;
|
|
178
178
|
if (variableDeclarations.length === 1) {
|
|
179
179
|
const variable = variableDeclarations[0];
|
|
180
|
-
|
|
181
180
|
if (variable.initializer) {
|
|
182
181
|
let resultingNode;
|
|
183
182
|
if (
|
|
@@ -192,13 +191,6 @@ export class TsConverter {
|
|
|
192
191
|
resultingNode = this.tsLiteralToType(variable.initializer);
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
// If resultingNode is a reference to a function or custom primitive and not a concrete value
|
|
196
|
-
// we need to update the name to be the name of the exporting variable
|
|
197
|
-
// not the name of the identifier its aliasing
|
|
198
|
-
if (resultingNode.type === 'function' || resultingNode.type === 'ref') {
|
|
199
|
-
resultingNode = { ...resultingNode, name: variable.name.getText() };
|
|
200
|
-
}
|
|
201
|
-
|
|
202
194
|
return {
|
|
203
195
|
name: variable.name.getText(),
|
|
204
196
|
...resultingNode,
|
|
@@ -637,22 +629,12 @@ export class TsConverter {
|
|
|
637
629
|
const functionReturnType =
|
|
638
630
|
this.context.typeChecker.getTypeAtLocation(functionCall);
|
|
639
631
|
|
|
640
|
-
|
|
632
|
+
const syntheticNode = this.context.typeChecker.typeToTypeNode(
|
|
641
633
|
functionReturnType,
|
|
642
634
|
document,
|
|
643
635
|
undefined
|
|
644
636
|
);
|
|
645
637
|
|
|
646
|
-
// Synthetic node loses parameter location information, and text making it unable
|
|
647
|
-
// to get the parameter name in tsNodeToType
|
|
648
|
-
if (ts.isArrowFunction(functionCall)) {
|
|
649
|
-
const syntheticWithParameters = {
|
|
650
|
-
...syntheticNode,
|
|
651
|
-
parameters: functionCall.parameters,
|
|
652
|
-
};
|
|
653
|
-
syntheticNode = syntheticWithParameters as unknown as ts.TypeNode;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
638
|
if (syntheticNode) {
|
|
657
639
|
if (
|
|
658
640
|
ts.isTypeReferenceNode(syntheticNode) &&
|