@player-tools/xlr-converters 0.3.0-next.2 → 0.3.1-next.0

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 CHANGED
@@ -120,6 +120,9 @@ 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
+ }
123
126
  return __spreadValues$1({
124
127
  name: variable.name.getText()
125
128
  }, resultingNode);
@@ -302,7 +305,7 @@ class TsConverter {
302
305
  }
303
306
  if (ts__default["default"].isTypeQueryNode(node)) {
304
307
  const effectiveType = this.context.typeChecker.getTypeAtLocation(node);
305
- const syntheticType = this.context.typeChecker.typeToTypeNode(effectiveType, node, void 0);
308
+ const syntheticType = this.context.typeChecker.typeToTypeNode(effectiveType, node, ts__default["default"].NodeBuilderFlags.NoTruncation);
306
309
  if (syntheticType) {
307
310
  return this.tsNodeToType(syntheticType);
308
311
  }
package/dist/index.esm.js CHANGED
@@ -112,6 +112,9 @@ 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
+ }
115
118
  return __spreadValues$1({
116
119
  name: variable.name.getText()
117
120
  }, resultingNode);
@@ -294,7 +297,7 @@ class TsConverter {
294
297
  }
295
298
  if (ts.isTypeQueryNode(node)) {
296
299
  const effectiveType = this.context.typeChecker.getTypeAtLocation(node);
297
- const syntheticType = this.context.typeChecker.typeToTypeNode(effectiveType, node, void 0);
300
+ const syntheticType = this.context.typeChecker.typeToTypeNode(effectiveType, node, ts.NodeBuilderFlags.NoTruncation);
298
301
  if (syntheticType) {
299
302
  return this.tsNodeToType(syntheticType);
300
303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-tools/xlr-converters",
3
- "version": "0.3.0-next.2",
3
+ "version": "0.3.1-next.0",
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.2",
13
- "@player-tools/xlr-utils": "0.3.0-next.2",
12
+ "@player-tools/xlr": "0.3.1-next.0",
13
+ "@player-tools/xlr-utils": "0.3.1-next.0",
14
14
  "@babel/runtime": "7.15.4"
15
15
  },
16
16
  "main": "dist/index.cjs.js",
package/src/ts-to-xlr.ts CHANGED
@@ -177,6 +177,7 @@ export class TsConverter {
177
177
  const variableDeclarations = node.declarationList.declarations;
178
178
  if (variableDeclarations.length === 1) {
179
179
  const variable = variableDeclarations[0];
180
+
180
181
  if (variable.initializer) {
181
182
  let resultingNode;
182
183
  if (
@@ -191,6 +192,13 @@ export class TsConverter {
191
192
  resultingNode = this.tsLiteralToType(variable.initializer);
192
193
  }
193
194
 
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
+
194
202
  return {
195
203
  name: variable.name.getText(),
196
204
  ...resultingNode,
@@ -461,7 +469,7 @@ export class TsConverter {
461
469
  const syntheticType = this.context.typeChecker.typeToTypeNode(
462
470
  effectiveType,
463
471
  node,
464
- undefined
472
+ ts.NodeBuilderFlags.NoTruncation
465
473
  );
466
474
  if (syntheticType) {
467
475
  return this.tsNodeToType(syntheticType);