@player-tools/xlr-converters 0.3.0-next.1 → 0.3.0-next.2
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 +7 -1
- package/dist/index.esm.js +7 -1
- package/package.json +3 -3
- package/src/ts-to-xlr.ts +11 -1
package/dist/index.cjs.js
CHANGED
|
@@ -412,7 +412,13 @@ class TsConverter {
|
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
414
|
const functionReturnType = this.context.typeChecker.getTypeAtLocation(functionCall);
|
|
415
|
-
|
|
415
|
+
let syntheticNode = this.context.typeChecker.typeToTypeNode(functionReturnType, document, void 0);
|
|
416
|
+
if (ts__default["default"].isArrowFunction(functionCall)) {
|
|
417
|
+
const syntheticWithParameters = __spreadProps(__spreadValues$1({}, syntheticNode), {
|
|
418
|
+
parameters: functionCall.parameters
|
|
419
|
+
});
|
|
420
|
+
syntheticNode = syntheticWithParameters;
|
|
421
|
+
}
|
|
416
422
|
if (syntheticNode) {
|
|
417
423
|
if (ts__default["default"].isTypeReferenceNode(syntheticNode) && ts__default["default"].isIdentifier(syntheticNode.typeName)) {
|
|
418
424
|
const { typeName } = syntheticNode;
|
package/dist/index.esm.js
CHANGED
|
@@ -404,7 +404,13 @@ class TsConverter {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
const functionReturnType = this.context.typeChecker.getTypeAtLocation(functionCall);
|
|
407
|
-
|
|
407
|
+
let syntheticNode = this.context.typeChecker.typeToTypeNode(functionReturnType, document, void 0);
|
|
408
|
+
if (ts.isArrowFunction(functionCall)) {
|
|
409
|
+
const syntheticWithParameters = __spreadProps(__spreadValues$1({}, syntheticNode), {
|
|
410
|
+
parameters: functionCall.parameters
|
|
411
|
+
});
|
|
412
|
+
syntheticNode = syntheticWithParameters;
|
|
413
|
+
}
|
|
408
414
|
if (syntheticNode) {
|
|
409
415
|
if (ts.isTypeReferenceNode(syntheticNode) && ts.isIdentifier(syntheticNode.typeName)) {
|
|
410
416
|
const { typeName } = syntheticNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-tools/xlr-converters",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"typescript": "4.8.4"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@player-tools/xlr": "0.3.0-next.
|
|
13
|
-
"@player-tools/xlr-utils": "0.3.0-next.
|
|
12
|
+
"@player-tools/xlr": "0.3.0-next.2",
|
|
13
|
+
"@player-tools/xlr-utils": "0.3.0-next.2",
|
|
14
14
|
"@babel/runtime": "7.15.4"
|
|
15
15
|
},
|
|
16
16
|
"main": "dist/index.cjs.js",
|
package/src/ts-to-xlr.ts
CHANGED
|
@@ -629,12 +629,22 @@ export class TsConverter {
|
|
|
629
629
|
const functionReturnType =
|
|
630
630
|
this.context.typeChecker.getTypeAtLocation(functionCall);
|
|
631
631
|
|
|
632
|
-
|
|
632
|
+
let syntheticNode = this.context.typeChecker.typeToTypeNode(
|
|
633
633
|
functionReturnType,
|
|
634
634
|
document,
|
|
635
635
|
undefined
|
|
636
636
|
);
|
|
637
637
|
|
|
638
|
+
// Synthetic node loses parameter location information, and text making it unable
|
|
639
|
+
// to get the parameter name in tsNodeToType
|
|
640
|
+
if (ts.isArrowFunction(functionCall)) {
|
|
641
|
+
const syntheticWithParameters = {
|
|
642
|
+
...syntheticNode,
|
|
643
|
+
parameters: functionCall.parameters,
|
|
644
|
+
};
|
|
645
|
+
syntheticNode = syntheticWithParameters as unknown as ts.TypeNode;
|
|
646
|
+
}
|
|
647
|
+
|
|
638
648
|
if (syntheticNode) {
|
|
639
649
|
if (
|
|
640
650
|
ts.isTypeReferenceNode(syntheticNode) &&
|