@zyno-io/ts-reflection 26.813.2308 → 26.816.840

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.
@@ -90,10 +90,11 @@ func classFromNode(info *fileInfo, node *shimast.Node) *classInfo {
90
90
  continue
91
91
  }
92
92
  class.properties = append(class.properties, propertyInfo{
93
- name: name,
94
- typeText: nodeText(file, member.Type()),
95
- typeNode: member.Type(),
96
- optional: member.QuestionToken() != nil,
93
+ name: name,
94
+ typeText: nodeText(file, member.Type()),
95
+ typeNode: member.Type(),
96
+ declaration: member,
97
+ optional: member.QuestionToken() != nil,
97
98
  })
98
99
  case shimast.KindMethodDeclaration:
99
100
  name := memberName(file, member)
@@ -102,6 +102,7 @@ type propertyInfo struct {
102
102
  name string
103
103
  typeText string
104
104
  typeNode *shimast.Node
105
+ declaration *shimast.Node
105
106
  metadataText string
106
107
  optional bool
107
108
  }
@@ -57,6 +57,13 @@ func precomputeClassMetadataExpressions(info *fileInfo, reg *registry, class *cl
57
57
  }
58
58
  for i := range class.properties {
59
59
  prop := &class.properties[i]
60
+ if prop.typeNode == nil && prop.declaration != nil && reg.checker != nil {
61
+ inferredType := reg.checker.GetTypeAtLocation(prop.declaration)
62
+ if metadata, ok := typiaTypeExprFromType(info, reg, inferredType, class.pos, ""); ok {
63
+ prop.metadataText = metadata
64
+ continue
65
+ }
66
+ }
60
67
  prop.metadataText = typeExprForNode(info, reg, prop.typeText, prop.typeNode, class.pos)
61
68
  }
62
69
  for i := range class.methods {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyno-io/ts-reflection",
3
- "version": "26.813.2308",
3
+ "version": "26.816.840",
4
4
  "description": "Browser-neutral TypeScript reflection and runtime metadata",
5
5
  "license": "MIT",
6
6
  "files": [