@openpkg-ts/sdk 0.47.0 → 0.47.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.js +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3213,6 +3213,11 @@ class TypeRegistry {
|
|
|
3213
3213
|
if (type.flags & ts5.TypeFlags.Conditional) {
|
|
3214
3214
|
return { "x-ts-type": renderTypeText(type, checker) };
|
|
3215
3215
|
}
|
|
3216
|
+
const constraint = checker.getBaseConstraintOfType(type);
|
|
3217
|
+
const primitive = constraint && constraint.flags & ts5.TypeFlags.StringLike ? "string" : constraint && constraint.flags & ts5.TypeFlags.NumberLike ? "number" : constraint && constraint.flags & ts5.TypeFlags.BooleanLike ? "boolean" : undefined;
|
|
3218
|
+
if (primitive) {
|
|
3219
|
+
return { type: primitive, "x-ts-type": renderTypeText(type, checker) };
|
|
3220
|
+
}
|
|
3216
3221
|
return this.buildObjectSchemaFromProperties(type, checker, ctx);
|
|
3217
3222
|
}
|
|
3218
3223
|
buildEnumSchema(symbol, checker) {
|
|
@@ -4246,7 +4251,8 @@ function serializeResolvedMembers(type, node, ctx) {
|
|
|
4246
4251
|
const armDocs = buildConditionalArmDocs(node.type, checker);
|
|
4247
4252
|
for (const prop of type.getProperties()) {
|
|
4248
4253
|
const decl = prop.getDeclarations()?.[0] ?? node;
|
|
4249
|
-
const
|
|
4254
|
+
const rawPropType = checker.getTypeOfSymbolAtLocation(prop, decl);
|
|
4255
|
+
const propType = prop.flags & ts10.SymbolFlags.Optional ? stripUndefinedFromType(rawPropType, checker) : rawPropType;
|
|
4250
4256
|
registerReferencedTypes(propType, ctx);
|
|
4251
4257
|
const callSigs = propType.getCallSignatures();
|
|
4252
4258
|
const isMethodDecl = ts10.isMethodSignature(decl) || ts10.isMethodDeclaration(decl) || ts10.isFunctionDeclaration(decl);
|