@formspec/build 0.1.0-alpha.57 → 0.1.0-alpha.59

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/cli.cjs CHANGED
@@ -1070,7 +1070,7 @@ function generateJsonSchemaFromIR(ir, options) {
1070
1070
  applyConstraints(ctx.defs[schemaName], typeDef.constraints, ctx);
1071
1071
  }
1072
1072
  if (typeDef.annotations && typeDef.annotations.length > 0) {
1073
- applyAnnotations(ctx.defs[schemaName], typeDef.annotations, ctx);
1073
+ applyAnnotations(ctx.defs[schemaName], typeDef.annotations, ctx, typeDef.type);
1074
1074
  }
1075
1075
  }
1076
1076
  const properties = {};
@@ -1143,7 +1143,7 @@ function generateFieldSchema(field, ctx) {
1143
1143
  }
1144
1144
  }
1145
1145
  applyResolvedMetadata(schema, field.metadata);
1146
- applyAnnotations(schema, rootAnnotations, ctx);
1146
+ applyAnnotations(schema, rootAnnotations, ctx, field.type);
1147
1147
  if (itemStringSchema !== void 0) {
1148
1148
  applyAnnotations(itemStringSchema, itemAnnotations, ctx);
1149
1149
  }
@@ -1186,32 +1186,36 @@ function applyPathTargetedConstraints(schema, pathConstraints, ctx, typeNode) {
1186
1186
  return schema;
1187
1187
  }
1188
1188
  if (schema.$ref) {
1189
- const { $ref, ...rest } = schema;
1190
- const refPart = { $ref };
1191
- const overridePart = {
1192
- properties: propertyOverrides,
1193
- ...rest
1189
+ return {
1190
+ ...schema,
1191
+ properties: propertyOverrides
1194
1192
  };
1195
- return { allOf: [refPart, overridePart] };
1196
1193
  }
1197
1194
  if (schema.type === "object" && schema.properties) {
1198
- const missingOverrides = {};
1199
1195
  for (const [target, overrideSchema] of Object.entries(propertyOverrides)) {
1200
- if (schema.properties[target]) {
1201
- mergeSchemaOverride(schema.properties[target], overrideSchema);
1202
- } else {
1203
- missingOverrides[target] = overrideSchema;
1196
+ if (Object.hasOwn(schema.properties, target)) {
1197
+ const existing = schema.properties[target];
1198
+ if (existing) {
1199
+ mergeSchemaOverride(existing, overrideSchema);
1200
+ continue;
1201
+ }
1204
1202
  }
1203
+ Object.defineProperty(schema.properties, target, {
1204
+ value: overrideSchema,
1205
+ writable: true,
1206
+ enumerable: true,
1207
+ configurable: true
1208
+ });
1205
1209
  }
1206
- if (Object.keys(missingOverrides).length === 0) {
1207
- return schema;
1208
- }
1209
- return {
1210
- allOf: [schema, { properties: missingOverrides }]
1211
- };
1210
+ return schema;
1212
1211
  }
1213
1212
  if (schema.allOf) {
1214
- schema.allOf = [...schema.allOf, { properties: propertyOverrides }];
1213
+ const overrideMember = { properties: propertyOverrides };
1214
+ const flattened = tryFlattenAllOfToSiblings(schema, overrideMember);
1215
+ if (flattened !== void 0) {
1216
+ return flattened;
1217
+ }
1218
+ schema.allOf = [...schema.allOf, overrideMember];
1215
1219
  return schema;
1216
1220
  }
1217
1221
  return schema;
@@ -1324,7 +1328,7 @@ function generatePropertySchema(prop, ctx) {
1324
1328
  const schema = generateTypeNode(prop.type, ctx);
1325
1329
  applyConstraints(schema, prop.constraints, ctx);
1326
1330
  applyResolvedMetadata(schema, prop.metadata);
1327
- applyAnnotations(schema, prop.annotations, ctx);
1331
+ applyAnnotations(schema, prop.annotations, ctx, prop.type);
1328
1332
  return schema;
1329
1333
  }
1330
1334
  function generateUnionType(type, ctx) {
@@ -1427,13 +1431,20 @@ function buildPropertyOverrides(pathConstraints, typeNode, ctx) {
1427
1431
  grouped.push(constraint);
1428
1432
  byTarget.set(target, grouped);
1429
1433
  }
1430
- const overrides = {};
1434
+ const overrides = /* @__PURE__ */ Object.create(null);
1431
1435
  for (const [target, constraints] of byTarget) {
1432
- overrides[resolveSerializedPropertyName(target, typeNode, ctx)] = buildPathOverrideSchema(
1436
+ const resolvedName = resolveSerializedPropertyName(target, typeNode, ctx);
1437
+ const schema = buildPathOverrideSchema(
1433
1438
  constraints.map(stripLeadingPathSegment),
1434
1439
  resolveTargetTypeNode(target, typeNode, ctx),
1435
1440
  ctx
1436
1441
  );
1442
+ Object.defineProperty(overrides, resolvedName, {
1443
+ value: schema,
1444
+ writable: true,
1445
+ enumerable: true,
1446
+ configurable: true
1447
+ });
1437
1448
  }
1438
1449
  return overrides;
1439
1450
  }
@@ -1460,6 +1471,34 @@ function buildPathOverrideSchema(constraints, typeNode, ctx) {
1460
1471
  schema.properties = buildPropertyOverrides(nestedConstraints, effectiveType, ctx);
1461
1472
  return schema;
1462
1473
  }
1474
+ function tryFlattenAllOfToSiblings(schema, overrideMember) {
1475
+ if (schema.allOf?.length !== 1) {
1476
+ return void 0;
1477
+ }
1478
+ const [soleMember] = schema.allOf;
1479
+ if (soleMember === void 0) {
1480
+ return void 0;
1481
+ }
1482
+ const { allOf: _allOf, ...outerRest } = schema;
1483
+ const outerKeys = new Set(Object.keys(outerRest));
1484
+ const memberKeys = new Set(Object.keys(soleMember));
1485
+ const overrideKeys = new Set(Object.keys(overrideMember));
1486
+ for (const key of memberKeys) {
1487
+ if (outerKeys.has(key) || overrideKeys.has(key)) {
1488
+ return void 0;
1489
+ }
1490
+ }
1491
+ for (const key of overrideKeys) {
1492
+ if (outerKeys.has(key)) {
1493
+ return void 0;
1494
+ }
1495
+ }
1496
+ return {
1497
+ ...outerRest,
1498
+ ...soleMember,
1499
+ ...overrideMember
1500
+ };
1501
+ }
1463
1502
  function mergeSchemaOverride(target, override) {
1464
1503
  const nullableValueBranch = getNullableUnionValueSchema(target);
1465
1504
  if (nullableValueBranch !== void 0) {
@@ -1467,11 +1506,16 @@ function mergeSchemaOverride(target, override) {
1467
1506
  return;
1468
1507
  }
1469
1508
  if (override.properties !== void 0) {
1470
- const mergedProperties = target.properties ?? {};
1509
+ const mergedProperties = target.properties ?? /* @__PURE__ */ Object.create(null);
1471
1510
  for (const [name, propertyOverride] of Object.entries(override.properties)) {
1472
- const existing = mergedProperties[name];
1511
+ const existing = Object.hasOwn(mergedProperties, name) ? mergedProperties[name] : void 0;
1473
1512
  if (existing === void 0) {
1474
- mergedProperties[name] = propertyOverride;
1513
+ Object.defineProperty(mergedProperties, name, {
1514
+ value: propertyOverride,
1515
+ writable: true,
1516
+ enumerable: true,
1517
+ configurable: true
1518
+ });
1475
1519
  } else {
1476
1520
  mergeSchemaOverride(existing, propertyOverride);
1477
1521
  }
@@ -1489,7 +1533,12 @@ function mergeSchemaOverride(target, override) {
1489
1533
  if (key === "properties" || key === "items") {
1490
1534
  continue;
1491
1535
  }
1492
- target[key] = value;
1536
+ Object.defineProperty(target, key, {
1537
+ value,
1538
+ writable: true,
1539
+ enumerable: true,
1540
+ configurable: true
1541
+ });
1493
1542
  }
1494
1543
  }
1495
1544
  function stripLeadingPathSegment(constraint) {
@@ -1589,7 +1638,7 @@ function applyConstraints(schema, constraints, ctx) {
1589
1638
  }
1590
1639
  }
1591
1640
  }
1592
- function applyAnnotations(schema, annotations, ctx) {
1641
+ function applyAnnotations(schema, annotations, ctx, typeNode) {
1593
1642
  for (const annotation of annotations) {
1594
1643
  switch (annotation.annotationKind) {
1595
1644
  case "displayName":
@@ -1602,7 +1651,7 @@ function applyAnnotations(schema, annotations, ctx) {
1602
1651
  schema[`${ctx.vendorPrefix}-remarks`] = annotation.value;
1603
1652
  break;
1604
1653
  case "defaultValue":
1605
- schema.default = annotation.value;
1654
+ schema.default = coerceDefaultValue(annotation.value, typeNode, schema, ctx);
1606
1655
  break;
1607
1656
  case "format":
1608
1657
  schema.format = annotation.value;
@@ -1627,6 +1676,34 @@ function applyAnnotations(schema, annotations, ctx) {
1627
1676
  }
1628
1677
  }
1629
1678
  }
1679
+ function coerceDefaultValue(value, typeNode, emittedSchema, ctx) {
1680
+ if (typeNode?.kind !== "custom") {
1681
+ return value;
1682
+ }
1683
+ const registration = ctx.extensionRegistry?.findType(typeNode.typeId);
1684
+ if (registration === void 0) {
1685
+ return value;
1686
+ }
1687
+ if (registration.serializeDefault !== void 0) {
1688
+ return registration.serializeDefault(value, typeNode.payload);
1689
+ }
1690
+ const declaredType = emittedSchema["type"];
1691
+ if (declaredType === "string" && typeof value !== "string") {
1692
+ if (typeof value === "number") {
1693
+ if (!Number.isFinite(value)) {
1694
+ return value;
1695
+ }
1696
+ return String(value);
1697
+ }
1698
+ if (typeof value === "boolean") {
1699
+ return String(value);
1700
+ }
1701
+ if (typeof value === "bigint") {
1702
+ return value.toString();
1703
+ }
1704
+ }
1705
+ return value;
1706
+ }
1630
1707
  function generateCustomType(type, ctx) {
1631
1708
  const registration = ctx.extensionRegistry?.findType(type.typeId);
1632
1709
  if (registration === void 0) {
@@ -2087,6 +2164,16 @@ function buildConstraintTagSources(extensions) {
2087
2164
  constraintTags: extension.constraintTags.map((tag) => ({
2088
2165
  tagName: (0, import_internal.normalizeFormSpecTagName)(tag.tagName)
2089
2166
  }))
2167
+ } : {},
2168
+ // Include customTypes so _validateExtensionSetup can check tsTypeNames for
2169
+ // unsupported built-in overrides and invalid identifier patterns.
2170
+ ...extension.types !== void 0 ? {
2171
+ customTypes: extension.types.map((type) => ({
2172
+ // tsTypeNames: deprecated in favour of symbol-based detection, but
2173
+ // still required for name-based validation in _validateExtensionSetup
2174
+ // until the bridge is fully retired (see §synthetic-checker-retirement §4C).
2175
+ tsTypeNames: type.tsTypeNames ?? [type.typeName]
2176
+ }))
2090
2177
  } : {}
2091
2178
  }));
2092
2179
  }
@@ -2096,7 +2183,13 @@ function createExtensionRegistry(extensions) {
2096
2183
  extensionCount: extensions.length,
2097
2184
  extensionIds: extensions.map((e) => e.extensionId)
2098
2185
  });
2099
- const reservedTagSources = buildConstraintTagSources(extensions);
2186
+ const extensionTagSources = buildConstraintTagSources(extensions);
2187
+ const setupDiagnostics = (0, import_internal._validateExtensionSetup)(extensionTagSources);
2188
+ (0, import_internal.logSetupDiagnostics)(registryLog, {
2189
+ diagnosticCount: setupDiagnostics.length,
2190
+ codes: setupDiagnostics.map((d) => d.kind)
2191
+ });
2192
+ const reservedTagSources = extensionTagSources;
2100
2193
  let symbolMap = /* @__PURE__ */ new Map();
2101
2194
  const typeMap = /* @__PURE__ */ new Map();
2102
2195
  const typeNameMap = /* @__PURE__ */ new Map();
@@ -2233,10 +2326,12 @@ function createExtensionRegistry(extensions) {
2233
2326
  constraintTagCount: constraintTagMap.size,
2234
2327
  broadeningCount: builtinBroadeningMap.size,
2235
2328
  annotationCount: annotationMap.size,
2236
- metadataSlotCount: metadataSlotMap.size
2329
+ metadataSlotCount: metadataSlotMap.size,
2330
+ setupDiagnosticCount: setupDiagnostics.length
2237
2331
  });
2238
2332
  return {
2239
2333
  extensions,
2334
+ setupDiagnostics,
2240
2335
  findType: (typeId) => typeMap.get(typeId),
2241
2336
  findTypeByName: (typeName) => typeNameMap.get(typeName),
2242
2337
  findTypeByBrand: (brand) => brandMap.get(brand),
@@ -2337,21 +2432,6 @@ var init_schema2 = __esm({
2337
2432
  });
2338
2433
 
2339
2434
  // src/extensions/ts-type-utils.ts
2340
- function collectBrandIdentifiers(type) {
2341
- if (!type.isIntersection()) {
2342
- return [];
2343
- }
2344
- const brands = [];
2345
- for (const prop of type.getProperties()) {
2346
- const decl = prop.valueDeclaration ?? prop.declarations?.[0];
2347
- if (decl === void 0) continue;
2348
- if (!ts.isPropertySignature(decl) && !ts.isPropertyDeclaration(decl)) continue;
2349
- if (!ts.isComputedPropertyName(decl.name)) continue;
2350
- if (!ts.isIdentifier(decl.name.expression)) continue;
2351
- brands.push(decl.name.expression.text);
2352
- }
2353
- return brands;
2354
- }
2355
2435
  function resolveCanonicalSymbol(type, checker) {
2356
2436
  const raw = type.aliasSymbol ?? type.getSymbol();
2357
2437
  if (raw === void 0) return void 0;
@@ -2443,7 +2523,7 @@ function resolveCustomTypeFromTsType(type, checker, registry, sourceNode) {
2443
2523
  return bySymbol;
2444
2524
  }
2445
2525
  }
2446
- for (const brand of collectBrandIdentifiers(stripped)) {
2526
+ for (const brand of (0, import_internal2._collectBrandIdentifiers)(stripped)) {
2447
2527
  const byBrand = registry.findTypeByBrand(brand);
2448
2528
  if (byBrand !== void 0) {
2449
2529
  return byBrand;
@@ -2465,17 +2545,11 @@ var init_resolve_custom_type = __esm({
2465
2545
  });
2466
2546
 
2467
2547
  // src/analyzer/builtin-brands.ts
2468
- function isIntegerBrandedType(type) {
2469
- if (!type.isIntersection()) return false;
2470
- if (!type.types.some((member) => !!(member.flags & ts3.TypeFlags.Number))) return false;
2471
- return collectBrandIdentifiers(type).includes("__integerBrand");
2472
- }
2473
- var ts3;
2548
+ var import_internal3;
2474
2549
  var init_builtin_brands = __esm({
2475
2550
  "src/analyzer/builtin-brands.ts"() {
2476
2551
  "use strict";
2477
- ts3 = __toESM(require("typescript"), 1);
2478
- init_ts_type_utils();
2552
+ import_internal3 = require("@formspec/analysis/internal");
2479
2553
  }
2480
2554
  });
2481
2555
 
@@ -2499,23 +2573,23 @@ function getExtensionTypeNames(registry) {
2499
2573
  function collectImportedNames(sourceFile) {
2500
2574
  const importedNames = /* @__PURE__ */ new Set();
2501
2575
  for (const statement of sourceFile.statements) {
2502
- if (ts4.isImportDeclaration(statement) && statement.importClause !== void 0) {
2576
+ if (ts3.isImportDeclaration(statement) && statement.importClause !== void 0) {
2503
2577
  const clause = statement.importClause;
2504
2578
  if (clause.name !== void 0) {
2505
2579
  importedNames.add(clause.name.text);
2506
2580
  }
2507
2581
  if (clause.namedBindings !== void 0) {
2508
- if (ts4.isNamedImports(clause.namedBindings)) {
2582
+ if (ts3.isNamedImports(clause.namedBindings)) {
2509
2583
  for (const specifier of clause.namedBindings.elements) {
2510
2584
  importedNames.add(specifier.name.text);
2511
2585
  }
2512
- } else if (ts4.isNamespaceImport(clause.namedBindings)) {
2586
+ } else if (ts3.isNamespaceImport(clause.namedBindings)) {
2513
2587
  importedNames.add(clause.namedBindings.name.text);
2514
2588
  }
2515
2589
  }
2516
2590
  continue;
2517
2591
  }
2518
- if (ts4.isImportEqualsDeclaration(statement)) {
2592
+ if (ts3.isImportEqualsDeclaration(statement)) {
2519
2593
  importedNames.add(statement.name.text);
2520
2594
  }
2521
2595
  }
@@ -2523,13 +2597,13 @@ function collectImportedNames(sourceFile) {
2523
2597
  }
2524
2598
  function isNonReferenceIdentifier(node) {
2525
2599
  const parent = node.parent;
2526
- if ((ts4.isBindingElement(parent) || ts4.isClassDeclaration(parent) || ts4.isEnumDeclaration(parent) || ts4.isEnumMember(parent) || ts4.isFunctionDeclaration(parent) || ts4.isFunctionExpression(parent) || ts4.isImportClause(parent) || ts4.isImportEqualsDeclaration(parent) || ts4.isImportSpecifier(parent) || ts4.isInterfaceDeclaration(parent) || ts4.isMethodDeclaration(parent) || ts4.isMethodSignature(parent) || ts4.isModuleDeclaration(parent) || ts4.isNamespaceExport(parent) || ts4.isNamespaceImport(parent) || ts4.isParameter(parent) || ts4.isPropertyDeclaration(parent) || ts4.isPropertySignature(parent) || ts4.isSetAccessorDeclaration(parent) || ts4.isGetAccessorDeclaration(parent) || ts4.isTypeAliasDeclaration(parent) || ts4.isTypeParameterDeclaration(parent) || ts4.isVariableDeclaration(parent)) && parent.name === node) {
2600
+ if ((ts3.isBindingElement(parent) || ts3.isClassDeclaration(parent) || ts3.isEnumDeclaration(parent) || ts3.isEnumMember(parent) || ts3.isFunctionDeclaration(parent) || ts3.isFunctionExpression(parent) || ts3.isImportClause(parent) || ts3.isImportEqualsDeclaration(parent) || ts3.isImportSpecifier(parent) || ts3.isInterfaceDeclaration(parent) || ts3.isMethodDeclaration(parent) || ts3.isMethodSignature(parent) || ts3.isModuleDeclaration(parent) || ts3.isNamespaceExport(parent) || ts3.isNamespaceImport(parent) || ts3.isParameter(parent) || ts3.isPropertyDeclaration(parent) || ts3.isPropertySignature(parent) || ts3.isSetAccessorDeclaration(parent) || ts3.isGetAccessorDeclaration(parent) || ts3.isTypeAliasDeclaration(parent) || ts3.isTypeParameterDeclaration(parent) || ts3.isVariableDeclaration(parent)) && parent.name === node) {
2527
2601
  return true;
2528
2602
  }
2529
- if ((ts4.isPropertyAssignment(parent) || ts4.isPropertyAccessExpression(parent)) && parent.name === node) {
2603
+ if ((ts3.isPropertyAssignment(parent) || ts3.isPropertyAccessExpression(parent)) && parent.name === node) {
2530
2604
  return true;
2531
2605
  }
2532
- if (ts4.isQualifiedName(parent) && parent.right === node) {
2606
+ if (ts3.isQualifiedName(parent) && parent.right === node) {
2533
2607
  return true;
2534
2608
  }
2535
2609
  return false;
@@ -2541,20 +2615,20 @@ function astReferencesImportedName(root, importedNames) {
2541
2615
  let found = false;
2542
2616
  const visit = (node) => {
2543
2617
  if (found) return;
2544
- if (ts4.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
2618
+ if (ts3.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
2545
2619
  found = true;
2546
2620
  return;
2547
2621
  }
2548
- ts4.forEachChild(node, visit);
2622
+ ts3.forEachChild(node, visit);
2549
2623
  };
2550
2624
  visit(root);
2551
2625
  return found;
2552
2626
  }
2553
2627
  function getObjectMembers(statement) {
2554
- if (ts4.isInterfaceDeclaration(statement)) {
2628
+ if (ts3.isInterfaceDeclaration(statement)) {
2555
2629
  return statement.members;
2556
2630
  }
2557
- if (ts4.isTypeLiteralNode(statement.type)) {
2631
+ if (ts3.isTypeLiteralNode(statement.type)) {
2558
2632
  return statement.type.members;
2559
2633
  }
2560
2634
  return void 0;
@@ -2566,7 +2640,7 @@ function rewriteImportedMemberTypes(statement, sourceFile, importedNames) {
2566
2640
  }
2567
2641
  const replacements = [];
2568
2642
  for (const member of members) {
2569
- if (!ts4.isPropertySignature(member)) {
2643
+ if (!ts3.isPropertySignature(member)) {
2570
2644
  if (astReferencesImportedName(member, importedNames)) {
2571
2645
  return null;
2572
2646
  }
@@ -2598,14 +2672,14 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
2598
2672
  );
2599
2673
  const result = [];
2600
2674
  for (const statement of sourceFile.statements) {
2601
- if (ts4.isImportDeclaration(statement)) continue;
2602
- if (ts4.isImportEqualsDeclaration(statement)) continue;
2603
- if (ts4.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0) continue;
2675
+ if (ts3.isImportDeclaration(statement)) continue;
2676
+ if (ts3.isImportEqualsDeclaration(statement)) continue;
2677
+ if (ts3.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0) continue;
2604
2678
  if (!astReferencesImportedName(statement, importedNamesToSkip)) {
2605
2679
  result.push(statement.getText(sourceFile));
2606
2680
  continue;
2607
2681
  }
2608
- if (ts4.isInterfaceDeclaration(statement) || ts4.isTypeAliasDeclaration(statement)) {
2682
+ if (ts3.isInterfaceDeclaration(statement) || ts3.isTypeAliasDeclaration(statement)) {
2609
2683
  const rewritten = rewriteImportedMemberTypes(statement, sourceFile, importedNamesToSkip);
2610
2684
  if (rewritten !== null) {
2611
2685
  result.push(rewritten);
@@ -2630,6 +2704,7 @@ function processConstraintTag(tagName, text, parsedTag, provenance, node, source
2630
2704
  sourceFile,
2631
2705
  tagName,
2632
2706
  parsedTag,
2707
+ text,
2633
2708
  provenance,
2634
2709
  supportingDeclarations,
2635
2710
  options
@@ -2638,7 +2713,7 @@ function processConstraintTag(tagName, text, parsedTag, provenance, node, source
2638
2713
  pushUniqueCompilerDiagnostics(diagnostics, compilerDiagnostics);
2639
2714
  return;
2640
2715
  }
2641
- const constraintNode = (0, import_internal3.parseConstraintTagValue)(
2716
+ const constraintNode = (0, import_internal4.parseConstraintTagValue)(
2642
2717
  tagName,
2643
2718
  text,
2644
2719
  provenance,
@@ -2657,6 +2732,9 @@ function renderSyntheticArgumentExpression(valueKind, argumentText) {
2657
2732
  case "number":
2658
2733
  case "integer":
2659
2734
  case "signedInteger":
2735
+ if (trimmed === "Infinity" || trimmed === "-Infinity" || trimmed === "NaN") {
2736
+ return trimmed;
2737
+ }
2660
2738
  return Number.isFinite(Number(trimmed)) ? trimmed : JSON.stringify(trimmed);
2661
2739
  case "string":
2662
2740
  return JSON.stringify(argumentText);
@@ -2688,12 +2766,12 @@ function supportsConstraintCapability(type, checker, capability) {
2688
2766
  if (capability === void 0) {
2689
2767
  return true;
2690
2768
  }
2691
- if ((0, import_internal3.hasTypeSemanticCapability)(type, checker, capability)) {
2769
+ if ((0, import_internal4.hasTypeSemanticCapability)(type, checker, capability)) {
2692
2770
  return true;
2693
2771
  }
2694
2772
  if (capability === "string-like") {
2695
2773
  const itemType = getArrayElementType(type, checker);
2696
- return itemType !== null && (0, import_internal3.hasTypeSemanticCapability)(itemType, checker, capability);
2774
+ return itemType !== null && (0, import_internal4.hasTypeSemanticCapability)(itemType, checker, capability);
2697
2775
  }
2698
2776
  return false;
2699
2777
  }
@@ -2702,7 +2780,7 @@ function stripHintNullishUnion(type) {
2702
2780
  return type;
2703
2781
  }
2704
2782
  const nonNullish = type.types.filter(
2705
- (member) => (member.flags & (ts4.TypeFlags.Null | ts4.TypeFlags.Undefined)) === 0
2783
+ (member) => (member.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined)) === 0
2706
2784
  );
2707
2785
  if (nonNullish.length === 1 && nonNullish[0] !== void 0) {
2708
2786
  return nonNullish[0];
@@ -2718,10 +2796,10 @@ function isUserEmittableHintProperty(property, declaration) {
2718
2796
  }
2719
2797
  if ("name" in declaration && declaration.name !== void 0) {
2720
2798
  const name = declaration.name;
2721
- if (ts4.isComputedPropertyName(name) || ts4.isPrivateIdentifier(name)) {
2799
+ if (ts3.isComputedPropertyName(name) || ts3.isPrivateIdentifier(name)) {
2722
2800
  return false;
2723
2801
  }
2724
- if (!ts4.isIdentifier(name) && !ts4.isStringLiteral(name) && !ts4.isNumericLiteral(name)) {
2802
+ if (!ts3.isIdentifier(name) && !ts3.isStringLiteral(name) && !ts3.isNumericLiteral(name)) {
2725
2803
  return false;
2726
2804
  }
2727
2805
  }
@@ -2737,7 +2815,7 @@ function collectObjectSubfieldCandidates(type, checker, capability) {
2737
2815
  if (isCallableType(stripped)) {
2738
2816
  return;
2739
2817
  }
2740
- if (!(0, import_internal3.hasTypeSemanticCapability)(stripped, checker, "object-like")) {
2818
+ if (!(0, import_internal4.hasTypeSemanticCapability)(stripped, checker, "object-like")) {
2741
2819
  return;
2742
2820
  }
2743
2821
  for (const property of stripped.getProperties()) {
@@ -2755,7 +2833,7 @@ function collectObjectSubfieldCandidates(type, checker, capability) {
2755
2833
  continue;
2756
2834
  }
2757
2835
  const strippedPropertyType = stripHintNullishUnion(propertyType);
2758
- if (!isCallableType(strippedPropertyType) && (0, import_internal3.hasTypeSemanticCapability)(strippedPropertyType, checker, "object-like")) {
2836
+ if (!isCallableType(strippedPropertyType) && (0, import_internal4.hasTypeSemanticCapability)(strippedPropertyType, checker, "object-like")) {
2759
2837
  visit(strippedPropertyType, path5, depth + 1);
2760
2838
  }
2761
2839
  }
@@ -2764,7 +2842,7 @@ function collectObjectSubfieldCandidates(type, checker, capability) {
2764
2842
  return out;
2765
2843
  }
2766
2844
  function buildPathTargetHint(subjectType, checker, capability, tagName, argumentText) {
2767
- if (!(0, import_internal3.hasTypeSemanticCapability)(subjectType, checker, "object-like")) {
2845
+ if (!(0, import_internal4.hasTypeSemanticCapability)(subjectType, checker, "object-like")) {
2768
2846
  return null;
2769
2847
  }
2770
2848
  const candidates = collectObjectSubfieldCandidates(subjectType, checker, capability);
@@ -2866,7 +2944,7 @@ function hasBuiltinConstraintBroadening(tagName, options) {
2866
2944
  const broadenedTypeId = getBroadenedCustomTypeId(options?.fieldType);
2867
2945
  return broadenedTypeId !== void 0 && options?.extensionRegistry?.findBuiltinConstraintBroadening(broadenedTypeId, tagName) !== void 0;
2868
2946
  }
2869
- function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, parsedTag, provenance, supportingDeclarations, options) {
2947
+ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, parsedTag, rawText, provenance, supportingDeclarations, options) {
2870
2948
  if (!(0, import_internals4.isBuiltinConstraintName)(tagName)) {
2871
2949
  return [];
2872
2950
  }
@@ -2875,22 +2953,24 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2875
2953
  if (checker === void 0 || subjectType === void 0) {
2876
2954
  return [];
2877
2955
  }
2878
- const placement = (0, import_internal3.resolveDeclarationPlacement)(node);
2956
+ const placement = (0, import_internal4.resolveDeclarationPlacement)(node);
2879
2957
  if (placement === null) {
2880
2958
  return [];
2881
2959
  }
2882
- const definition = (0, import_internal3.getTagDefinition)(tagName, options?.extensionRegistry?.extensions);
2960
+ const definition = (0, import_internal4.getTagDefinition)(tagName, options?.extensionRegistry?.extensions);
2883
2961
  if (definition === null) {
2884
2962
  return [];
2885
2963
  }
2886
2964
  const nonNullPlacement = placement;
2887
- const log2 = (0, import_internal4.getBuildLogger)();
2888
- const broadeningLog = (0, import_internal4.getBroadeningLogger)();
2889
- const syntheticLog = (0, import_internal4.getSyntheticLogger)();
2965
+ const log2 = (0, import_internal5.getBuildLogger)();
2966
+ const broadeningLog = (0, import_internal5.getBroadeningLogger)();
2967
+ const syntheticLog = (0, import_internal5.getSyntheticLogger)();
2968
+ const typedParserLog = (0, import_internal5.getTypedParserLogger)();
2890
2969
  const logsEnabled = log2 !== import_core4.noopLogger || broadeningLog !== import_core4.noopLogger;
2891
2970
  const syntheticTraceEnabled = syntheticLog !== import_core4.noopLogger;
2892
- const logStart = logsEnabled ? (0, import_internal4.nowMicros)() : 0;
2893
- const subjectTypeKind = logsEnabled ? (0, import_internal4.describeTypeKind)(subjectType, checker) : "";
2971
+ const typedParserTraceEnabled = typedParserLog !== import_core4.noopLogger;
2972
+ const logStart = logsEnabled ? (0, import_internal5.nowMicros)() : 0;
2973
+ const subjectTypeKind = logsEnabled ? (0, import_internal5.describeTypeKind)(subjectType, checker) : "";
2894
2974
  function emit(outcome, result2) {
2895
2975
  if (!logsEnabled) {
2896
2976
  return result2;
@@ -2901,11 +2981,11 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2901
2981
  placement: nonNullPlacement,
2902
2982
  subjectTypeKind,
2903
2983
  roleOutcome: outcome,
2904
- elapsedMicros: (0, import_internal4.elapsedMicros)(logStart)
2984
+ elapsedMicros: (0, import_internal5.elapsedMicros)(logStart)
2905
2985
  };
2906
- (0, import_internal4.logTagApplication)(log2, entry);
2986
+ (0, import_internal5.logTagApplication)(log2, entry);
2907
2987
  if (outcome === "bypass" || outcome === "D1" || outcome === "D2") {
2908
- (0, import_internal4.logTagApplication)(broadeningLog, entry);
2988
+ (0, import_internal5.logTagApplication)(broadeningLog, entry);
2909
2989
  }
2910
2990
  return result2;
2911
2991
  }
@@ -2940,7 +3020,7 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2940
3020
  )
2941
3021
  ]);
2942
3022
  }
2943
- const resolution = (0, import_internal3.resolvePathTargetType)(subjectType, checker, target.path.segments);
3023
+ const resolution = (0, import_internal4.resolvePathTargetType)(subjectType, checker, target.path.segments);
2944
3024
  if (resolution.kind === "missing-property") {
2945
3025
  return emit("B-reject", [
2946
3026
  makeDiagnostic(
@@ -2965,7 +3045,7 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2965
3045
  }
2966
3046
  const hasBroadening = (() => {
2967
3047
  if (target === null) {
2968
- if (isIntegerBrandedType((0, import_internal3.stripNullishUnion)(subjectType)) && definition.capabilities.includes("numeric-comparable")) {
3048
+ if ((0, import_internal3._isIntegerBrandedType)((0, import_internal4.stripNullishUnion)(subjectType)) && definition.capabilities.includes("numeric-comparable")) {
2969
3049
  return true;
2970
3050
  }
2971
3051
  return hasBuiltinConstraintBroadening(tagName, options);
@@ -2996,16 +3076,41 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
2996
3076
  ]);
2997
3077
  }
2998
3078
  }
2999
- const argumentExpression = renderSyntheticArgumentExpression(
3000
- definition.valueKind,
3001
- parsedTag?.argumentText ?? ""
3002
- );
3003
- if (definition.requiresArgument && argumentExpression === null) {
3004
- return emit("A-pass", []);
3005
- }
3006
3079
  if (hasBroadening) {
3007
3080
  return emit("bypass", []);
3008
3081
  }
3082
+ const effectiveArgumentText = (0, import_internal5.extractEffectiveArgumentText)(tagName, rawText, parsedTag);
3083
+ const typedParseResult = (0, import_internal5.parseTagArgument)(tagName, effectiveArgumentText, "build");
3084
+ if (!typedParseResult.ok) {
3085
+ if (typedParserTraceEnabled) {
3086
+ typedParserLog.trace("typed-parser C-reject", {
3087
+ consumer: "build",
3088
+ tag: tagName,
3089
+ placement: nonNullPlacement,
3090
+ subjectTypeKind: subjectTypeKind !== "" ? subjectTypeKind : "-",
3091
+ roleOutcome: "C-reject",
3092
+ diagnosticCode: typedParseResult.diagnostic.code
3093
+ });
3094
+ }
3095
+ const mappedCode = (0, import_internal5.mapTypedParserDiagnosticCode)(typedParseResult.diagnostic.code, tagName);
3096
+ return emit("C-reject", [
3097
+ makeDiagnostic(mappedCode, typedParseResult.diagnostic.message, provenance)
3098
+ ]);
3099
+ }
3100
+ if (typedParserTraceEnabled) {
3101
+ typedParserLog.trace("typed-parser C-pass", {
3102
+ consumer: "build",
3103
+ tag: tagName,
3104
+ placement: nonNullPlacement,
3105
+ subjectTypeKind: subjectTypeKind !== "" ? subjectTypeKind : "-",
3106
+ roleOutcome: "C-pass",
3107
+ valueKind: typedParseResult.value.kind
3108
+ });
3109
+ }
3110
+ const argumentExpression = renderSyntheticArgumentExpression(
3111
+ definition.valueKind,
3112
+ effectiveArgumentText
3113
+ );
3009
3114
  const subjectTypeText = checker.typeToString(subjectType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
3010
3115
  const hostType = options?.hostType ?? subjectType;
3011
3116
  const hostTypeText = checker.typeToString(hostType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
@@ -3018,7 +3123,7 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
3018
3123
  subjectTypeText
3019
3124
  });
3020
3125
  }
3021
- const result = (0, import_internal3.checkSyntheticTagApplication)({
3126
+ const result = (0, import_internal4.checkSyntheticTagApplication)({
3022
3127
  tagName,
3023
3128
  placement,
3024
3129
  hostType: hostTypeText,
@@ -3044,13 +3149,13 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
3044
3149
  } : {}
3045
3150
  });
3046
3151
  if (result.diagnostics.length === 0) {
3047
- return emit("C-pass", []);
3152
+ return emit("D-pass", []);
3048
3153
  }
3049
3154
  const setupDiagnostic = result.diagnostics.find((diagnostic) => diagnostic.kind !== "typescript");
3050
3155
  if (setupDiagnostic !== void 0) {
3051
3156
  return emit("C-reject", [
3052
3157
  makeDiagnostic(
3053
- setupDiagnostic.kind === "unsupported-custom-type-override" ? "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE" : "SYNTHETIC_SETUP_FAILURE",
3158
+ (0, import_internal5._mapSetupDiagnosticCode)(setupDiagnostic.kind),
3054
3159
  setupDiagnostic.message,
3055
3160
  provenance
3056
3161
  )
@@ -3068,10 +3173,10 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
3068
3173
  function getExtensionTagNames(options) {
3069
3174
  return [
3070
3175
  ...options?.extensionRegistry?.extensions.flatMap(
3071
- (extension) => (extension.constraintTags ?? []).map((tag) => (0, import_internal3.normalizeFormSpecTagName)(tag.tagName))
3176
+ (extension) => (extension.constraintTags ?? []).map((tag) => (0, import_internal4.normalizeFormSpecTagName)(tag.tagName))
3072
3177
  ) ?? [],
3073
3178
  ...options?.extensionRegistry?.extensions.flatMap(
3074
- (extension) => (extension.metadataSlots ?? []).map((slot) => (0, import_internal3.normalizeFormSpecTagName)(slot.tagName))
3179
+ (extension) => (extension.metadataSlots ?? []).map((slot) => (0, import_internal4.normalizeFormSpecTagName)(slot.tagName))
3075
3180
  ) ?? []
3076
3181
  ].sort();
3077
3182
  }
@@ -3083,9 +3188,9 @@ function getExtensionRegistryCacheKey(registry) {
3083
3188
  (extension) => JSON.stringify({
3084
3189
  extensionId: extension.extensionId,
3085
3190
  typeNames: extension.types?.map((type) => type.typeName) ?? [],
3086
- constraintTags: extension.constraintTags?.map((tag) => (0, import_internal3.normalizeFormSpecTagName)(tag.tagName)) ?? [],
3191
+ constraintTags: extension.constraintTags?.map((tag) => (0, import_internal4.normalizeFormSpecTagName)(tag.tagName)) ?? [],
3087
3192
  metadataSlots: extension.metadataSlots?.map((slot) => ({
3088
- tagName: (0, import_internal3.normalizeFormSpecTagName)(slot.tagName),
3193
+ tagName: (0, import_internal4.normalizeFormSpecTagName)(slot.tagName),
3089
3194
  declarationKinds: [...slot.declarationKinds].sort(),
3090
3195
  allowBare: slot.allowBare !== false,
3091
3196
  qualifiers: (slot.qualifiers ?? []).map((qualifier) => ({
@@ -3117,6 +3222,16 @@ function parseTSDocTags(node, file = "", options) {
3117
3222
  if (cached !== void 0) {
3118
3223
  return cached;
3119
3224
  }
3225
+ const setupDiags = options?.extensionRegistry?.setupDiagnostics;
3226
+ if (setupDiags !== void 0 && setupDiags.length > 0) {
3227
+ const result2 = {
3228
+ constraints: [],
3229
+ annotations: [],
3230
+ diagnostics: (0, import_internal5._emitSetupDiagnostics)(setupDiags, file)
3231
+ };
3232
+ parseResultCache.set(cacheKey, result2);
3233
+ return result2;
3234
+ }
3120
3235
  const constraints = [];
3121
3236
  const annotations = [];
3122
3237
  const diagnostics = [];
@@ -3128,12 +3243,12 @@ function parseTSDocTags(node, file = "", options) {
3128
3243
  const sourceText = sourceFile.getFullText();
3129
3244
  const extensionTypeNames = getExtensionTypeNames(options?.extensionRegistry);
3130
3245
  const supportingDeclarations = buildSupportingDeclarations(sourceFile, extensionTypeNames);
3131
- const commentRanges = ts4.getLeadingCommentRanges(sourceText, node.getFullStart());
3246
+ const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
3132
3247
  const rawTextFallbacks = collectRawTextFallbacks(node, file);
3133
3248
  const extensionTagNames = getExtensionTagNames(options);
3134
3249
  if (commentRanges) {
3135
3250
  for (const range of commentRanges) {
3136
- if (range.kind !== ts4.SyntaxKind.MultiLineCommentTrivia) {
3251
+ if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) {
3137
3252
  continue;
3138
3253
  }
3139
3254
  const commentText = sourceText.substring(range.pos, range.end);
@@ -3141,7 +3256,7 @@ function parseTSDocTags(node, file = "", options) {
3141
3256
  continue;
3142
3257
  }
3143
3258
  const extensions = options?.extensionRegistry?.extensions;
3144
- const unified = (0, import_internal3.parseUnifiedComment)(commentText, {
3259
+ const unified = (0, import_internal4.parseUnifiedComment)(commentText, {
3145
3260
  offset: range.pos,
3146
3261
  extensionTagNames,
3147
3262
  ...extensions !== void 0 ? { extensions } : {}
@@ -3176,13 +3291,13 @@ function parseTSDocTags(node, file = "", options) {
3176
3291
  }
3177
3292
  continue;
3178
3293
  }
3179
- if (import_internal3.TAGS_REQUIRING_RAW_TEXT.has(tagName)) {
3294
+ if (import_internal4.TAGS_REQUIRING_RAW_TEXT.has(tagName)) {
3180
3295
  const fallback = rawTextFallbacks.get(tagName)?.shift();
3181
- const text2 = (0, import_internal3.choosePreferredPayloadText)(tag.resolvedPayloadText, fallback?.text ?? "");
3296
+ const text2 = (0, import_internal4.choosePreferredPayloadText)(tag.resolvedPayloadText, fallback?.text ?? "");
3182
3297
  if (text2 === "") continue;
3183
3298
  const provenance2 = provenanceForParsedTag(tag, sourceFile, file);
3184
3299
  if (tagName === "defaultValue") {
3185
- annotations.push((0, import_internal3.parseDefaultValueTagValue)(text2, provenance2));
3300
+ annotations.push((0, import_internal4.parseDefaultValueTagValue)(text2, provenance2));
3186
3301
  continue;
3187
3302
  }
3188
3303
  processConstraintTag(
@@ -3264,7 +3379,7 @@ function parseTSDocTags(node, file = "", options) {
3264
3379
  if (text === "") continue;
3265
3380
  const provenance = fallback.provenance;
3266
3381
  if (tagName === "defaultValue") {
3267
- annotations.push((0, import_internal3.parseDefaultValueTagValue)(text, provenance));
3382
+ annotations.push((0, import_internal4.parseDefaultValueTagValue)(text, provenance));
3268
3383
  continue;
3269
3384
  }
3270
3385
  processConstraintTag(
@@ -3290,13 +3405,13 @@ function extractDisplayNameMetadata(node) {
3290
3405
  const memberDisplayNames = /* @__PURE__ */ new Map();
3291
3406
  const sourceFile = node.getSourceFile();
3292
3407
  const sourceText = sourceFile.getFullText();
3293
- const commentRanges = ts4.getLeadingCommentRanges(sourceText, node.getFullStart());
3408
+ const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
3294
3409
  if (commentRanges) {
3295
3410
  for (const range of commentRanges) {
3296
- if (range.kind !== ts4.SyntaxKind.MultiLineCommentTrivia) continue;
3411
+ if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) continue;
3297
3412
  const commentText = sourceText.substring(range.pos, range.end);
3298
3413
  if (!commentText.startsWith("/**")) continue;
3299
- const unified = (0, import_internal3.parseUnifiedComment)(commentText);
3414
+ const unified = (0, import_internal4.parseUnifiedComment)(commentText);
3300
3415
  for (const tag of unified.tags) {
3301
3416
  if (tag.normalizedTagName !== "displayName") {
3302
3417
  continue;
@@ -3318,9 +3433,9 @@ function extractDisplayNameMetadata(node) {
3318
3433
  }
3319
3434
  function collectRawTextFallbacks(node, file) {
3320
3435
  const fallbacks = /* @__PURE__ */ new Map();
3321
- for (const tag of ts4.getJSDocTags(node)) {
3436
+ for (const tag of ts3.getJSDocTags(node)) {
3322
3437
  const tagName = (0, import_internals4.normalizeConstraintTagName)(tag.tagName.text);
3323
- if (!import_internal3.TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
3438
+ if (!import_internal4.TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
3324
3439
  const commentText = getTagCommentText(tag)?.trim() ?? "";
3325
3440
  if (commentText === "") continue;
3326
3441
  const entries = fallbacks.get(tagName) ?? [];
@@ -3333,7 +3448,7 @@ function collectRawTextFallbacks(node, file) {
3333
3448
  return fallbacks;
3334
3449
  }
3335
3450
  function isMemberTargetDisplayName(text) {
3336
- return (0, import_internal3.parseTagSyntax)("displayName", text).target !== null;
3451
+ return (0, import_internal4.parseTagSyntax)("displayName", text).target !== null;
3337
3452
  }
3338
3453
  function provenanceForComment(range, sourceFile, file, tagName) {
3339
3454
  const { line, character } = sourceFile.getLineAndCharacterOfPosition(range.pos);
@@ -3373,21 +3488,21 @@ function getTagCommentText(tag) {
3373
3488
  if (typeof tag.comment === "string") {
3374
3489
  return tag.comment;
3375
3490
  }
3376
- return ts4.getTextOfJSDocComment(tag.comment);
3491
+ return ts3.getTextOfJSDocComment(tag.comment);
3377
3492
  }
3378
- var ts4, import_internal3, import_internals4, import_internals5, import_core4, import_internal4, SYNTHETIC_TYPE_FORMAT_FLAGS, MAX_HINT_CANDIDATES, MAX_HINT_DEPTH, parseResultCache;
3493
+ var ts3, import_internal4, import_internals4, import_internals5, import_core4, import_internal5, SYNTHETIC_TYPE_FORMAT_FLAGS, MAX_HINT_CANDIDATES, MAX_HINT_DEPTH, parseResultCache;
3379
3494
  var init_tsdoc_parser = __esm({
3380
3495
  "src/analyzer/tsdoc-parser.ts"() {
3381
3496
  "use strict";
3382
- ts4 = __toESM(require("typescript"), 1);
3383
- import_internal3 = require("@formspec/analysis/internal");
3497
+ ts3 = __toESM(require("typescript"), 1);
3498
+ import_internal4 = require("@formspec/analysis/internal");
3384
3499
  import_internals4 = require("@formspec/core/internals");
3385
3500
  import_internals5 = require("@formspec/core/internals");
3386
3501
  import_core4 = require("@formspec/core");
3387
3502
  init_resolve_custom_type();
3388
3503
  init_builtin_brands();
3389
- import_internal4 = require("@formspec/analysis/internal");
3390
- SYNTHETIC_TYPE_FORMAT_FLAGS = ts4.TypeFormatFlags.NoTruncation | ts4.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
3504
+ import_internal5 = require("@formspec/analysis/internal");
3505
+ SYNTHETIC_TYPE_FORMAT_FLAGS = ts3.TypeFormatFlags.NoTruncation | ts3.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
3391
3506
  MAX_HINT_CANDIDATES = 5;
3392
3507
  MAX_HINT_DEPTH = 3;
3393
3508
  parseResultCache = /* @__PURE__ */ new Map();
@@ -3409,18 +3524,18 @@ function extractJSDocAnnotationNodes(node, file = "", options) {
3409
3524
  function extractDefaultValueAnnotation(initializer, file = "") {
3410
3525
  if (!initializer) return null;
3411
3526
  let value;
3412
- if (ts5.isStringLiteral(initializer)) {
3527
+ if (ts4.isStringLiteral(initializer)) {
3413
3528
  value = initializer.text;
3414
- } else if (ts5.isNumericLiteral(initializer)) {
3529
+ } else if (ts4.isNumericLiteral(initializer)) {
3415
3530
  value = Number(initializer.text);
3416
- } else if (initializer.kind === ts5.SyntaxKind.TrueKeyword) {
3531
+ } else if (initializer.kind === ts4.SyntaxKind.TrueKeyword) {
3417
3532
  value = true;
3418
- } else if (initializer.kind === ts5.SyntaxKind.FalseKeyword) {
3533
+ } else if (initializer.kind === ts4.SyntaxKind.FalseKeyword) {
3419
3534
  value = false;
3420
- } else if (initializer.kind === ts5.SyntaxKind.NullKeyword) {
3535
+ } else if (initializer.kind === ts4.SyntaxKind.NullKeyword) {
3421
3536
  value = null;
3422
- } else if (ts5.isPrefixUnaryExpression(initializer)) {
3423
- if (initializer.operator === ts5.SyntaxKind.MinusToken && ts5.isNumericLiteral(initializer.operand)) {
3537
+ } else if (ts4.isPrefixUnaryExpression(initializer)) {
3538
+ if (initializer.operator === ts4.SyntaxKind.MinusToken && ts4.isNumericLiteral(initializer.operand)) {
3424
3539
  value = -Number(initializer.operand.text);
3425
3540
  }
3426
3541
  }
@@ -3439,39 +3554,39 @@ function extractDefaultValueAnnotation(initializer, file = "") {
3439
3554
  }
3440
3555
  };
3441
3556
  }
3442
- var ts5;
3557
+ var ts4;
3443
3558
  var init_jsdoc_constraints = __esm({
3444
3559
  "src/analyzer/jsdoc-constraints.ts"() {
3445
3560
  "use strict";
3446
- ts5 = __toESM(require("typescript"), 1);
3561
+ ts4 = __toESM(require("typescript"), 1);
3447
3562
  init_tsdoc_parser();
3448
3563
  }
3449
3564
  });
3450
3565
 
3451
3566
  // src/analyzer/class-analyzer.ts
3452
3567
  function isObjectType(type) {
3453
- return !!(type.flags & ts6.TypeFlags.Object);
3568
+ return !!(type.flags & ts5.TypeFlags.Object);
3454
3569
  }
3455
3570
  function isIntersectionType(type) {
3456
- return !!(type.flags & ts6.TypeFlags.Intersection);
3571
+ return !!(type.flags & ts5.TypeFlags.Intersection);
3457
3572
  }
3458
3573
  function isResolvableObjectLikeAliasTypeNode(typeNode) {
3459
- if (ts6.isParenthesizedTypeNode(typeNode)) {
3574
+ if (ts5.isParenthesizedTypeNode(typeNode)) {
3460
3575
  return isResolvableObjectLikeAliasTypeNode(typeNode.type);
3461
3576
  }
3462
- if (ts6.isTypeLiteralNode(typeNode) || ts6.isTypeReferenceNode(typeNode)) {
3577
+ if (ts5.isTypeLiteralNode(typeNode) || ts5.isTypeReferenceNode(typeNode)) {
3463
3578
  return true;
3464
3579
  }
3465
- return ts6.isIntersectionTypeNode(typeNode) && typeNode.types.length > 0 && typeNode.types.every((member) => isResolvableObjectLikeAliasTypeNode(member));
3580
+ return ts5.isIntersectionTypeNode(typeNode) && typeNode.types.length > 0 && typeNode.types.every((member) => isResolvableObjectLikeAliasTypeNode(member));
3466
3581
  }
3467
3582
  function isSemanticallyPlainObjectLikeType(type, checker) {
3468
3583
  if (isIntersectionType(type)) {
3469
3584
  return type.types.length > 0 && type.types.every((member) => isSemanticallyPlainObjectLikeType(member, checker));
3470
3585
  }
3471
- return isObjectType(type) && checker.getSignaturesOfType(type, ts6.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, ts6.SignatureKind.Construct).length === 0 && !checker.isArrayType(type) && !checker.isTupleType(type);
3586
+ return isObjectType(type) && checker.getSignaturesOfType(type, ts5.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, ts5.SignatureKind.Construct).length === 0 && !checker.isArrayType(type) && !checker.isTupleType(type);
3472
3587
  }
3473
3588
  function isTypeReference(type) {
3474
- return !!(type.flags & ts6.TypeFlags.Object) && !!(type.objectFlags & ts6.ObjectFlags.Reference);
3589
+ return !!(type.flags & ts5.TypeFlags.Object) && !!(type.objectFlags & ts5.ObjectFlags.Reference);
3475
3590
  }
3476
3591
  function makeParseOptions(extensionRegistry, fieldType, checker, subjectType, hostType) {
3477
3592
  if (extensionRegistry === void 0 && fieldType === void 0 && checker === void 0 && subjectType === void 0 && hostType === void 0) {
@@ -3492,8 +3607,19 @@ function createAnalyzerMetadataPolicy(input, discriminator) {
3492
3607
  discriminator
3493
3608
  };
3494
3609
  }
3610
+ function deduplicateDiagnostics(diagnostics) {
3611
+ if (diagnostics.length <= 1) return diagnostics;
3612
+ const seen = /* @__PURE__ */ new Set();
3613
+ return diagnostics.filter((d) => {
3614
+ if (!DEDUPLICATABLE_DIAGNOSTIC_CODES.has(d.code)) return true;
3615
+ const key = `${d.code}\0${d.message}`;
3616
+ if (seen.has(key)) return false;
3617
+ seen.add(key);
3618
+ return true;
3619
+ });
3620
+ }
3495
3621
  function resolveNodeMetadata(metadataPolicy, declarationKind, logicalName, node, checker, extensionRegistry, buildContext) {
3496
- const analysis = (0, import_internal5.analyzeMetadataForNodeWithChecker)({
3622
+ const analysis = (0, import_internal6.analyzeMetadataForNodeWithChecker)({
3497
3623
  checker,
3498
3624
  node,
3499
3625
  logicalName,
@@ -3528,10 +3654,120 @@ function resolveNodeMetadata(metadataPolicy, declarationKind, logicalName, node,
3528
3654
  }
3529
3655
  return resolvedMetadata;
3530
3656
  }
3657
+ function getInheritableAnnotationStringValue(annotation) {
3658
+ if (annotation.annotationKind === "format") return annotation.value;
3659
+ return void 0;
3660
+ }
3661
+ function isOverridingInheritableAnnotation(annotation) {
3662
+ const value = getInheritableAnnotationStringValue(annotation);
3663
+ if (value === void 0) return true;
3664
+ return value.trim().length > 0;
3665
+ }
3666
+ function collectInheritedTypeAnnotations(derivedDecl, existingAnnotations, checker, extensionRegistry) {
3667
+ const existingKinds = new Set(
3668
+ existingAnnotations.filter(isOverridingInheritableAnnotation).map((a) => a.annotationKind)
3669
+ );
3670
+ const needed = /* @__PURE__ */ new Set();
3671
+ for (const kind of INHERITABLE_TYPE_ANNOTATION_KINDS) {
3672
+ if (!existingKinds.has(kind)) needed.add(kind);
3673
+ }
3674
+ if (needed.size === 0) return [];
3675
+ const inherited = [];
3676
+ const seen = /* @__PURE__ */ new Set([derivedDecl]);
3677
+ const queue = [];
3678
+ const resolveSymbolTarget = (sym) => {
3679
+ if ((sym.flags & ts5.SymbolFlags.Alias) === 0) return sym;
3680
+ try {
3681
+ return checker.getAliasedSymbol(sym);
3682
+ } catch {
3683
+ return sym;
3684
+ }
3685
+ };
3686
+ const isObjectShapedTypeAlias = (alias) => {
3687
+ const type = checker.getTypeFromTypeNode(alias.type);
3688
+ if ((type.flags & ts5.TypeFlags.Object) !== 0) return true;
3689
+ if (type.isIntersection()) return true;
3690
+ return false;
3691
+ };
3692
+ const enqueueCandidate = (baseDecl, fromTypeAliasRhs) => {
3693
+ if (seen.has(baseDecl)) return;
3694
+ if (ts5.isClassDeclaration(baseDecl) || ts5.isInterfaceDeclaration(baseDecl)) {
3695
+ seen.add(baseDecl);
3696
+ queue.push(baseDecl);
3697
+ return;
3698
+ }
3699
+ if (ts5.isTypeAliasDeclaration(baseDecl)) {
3700
+ if (!fromTypeAliasRhs && !isObjectShapedTypeAlias(baseDecl)) return;
3701
+ seen.add(baseDecl);
3702
+ queue.push(baseDecl);
3703
+ }
3704
+ };
3705
+ const enqueueBasesOf = (decl) => {
3706
+ if (ts5.isTypeAliasDeclaration(decl)) {
3707
+ const rhs = decl.type;
3708
+ if (!ts5.isTypeReferenceNode(rhs)) return;
3709
+ const sym = checker.getSymbolAtLocation(rhs.typeName);
3710
+ if (!sym) return;
3711
+ const target = resolveSymbolTarget(sym);
3712
+ for (const baseDecl of target.declarations ?? []) {
3713
+ enqueueCandidate(
3714
+ baseDecl,
3715
+ /*fromTypeAliasRhs*/
3716
+ true
3717
+ );
3718
+ }
3719
+ return;
3720
+ }
3721
+ const heritageClauses = decl.heritageClauses;
3722
+ if (!heritageClauses) return;
3723
+ for (const clause of heritageClauses) {
3724
+ if (clause.token !== ts5.SyntaxKind.ExtendsKeyword) continue;
3725
+ for (const typeExpr of clause.types) {
3726
+ const sym = checker.getSymbolAtLocation(typeExpr.expression);
3727
+ if (!sym) continue;
3728
+ const target = resolveSymbolTarget(sym);
3729
+ for (const baseDecl of target.declarations ?? []) {
3730
+ enqueueCandidate(
3731
+ baseDecl,
3732
+ /*fromTypeAliasRhs*/
3733
+ false
3734
+ );
3735
+ }
3736
+ }
3737
+ }
3738
+ };
3739
+ enqueueBasesOf(derivedDecl);
3740
+ for (let queueIndex = 0; queueIndex < queue.length && needed.size > 0; queueIndex++) {
3741
+ const baseDecl = queue[queueIndex];
3742
+ if (baseDecl === void 0) continue;
3743
+ const baseFile = baseDecl.getSourceFile().fileName;
3744
+ const baseAnnotations = extractJSDocAnnotationNodes(
3745
+ baseDecl,
3746
+ baseFile,
3747
+ makeParseOptions(extensionRegistry)
3748
+ );
3749
+ for (const annotation of baseAnnotations) {
3750
+ if (!needed.has(annotation.annotationKind)) continue;
3751
+ if (!isOverridingInheritableAnnotation(annotation)) continue;
3752
+ inherited.push(annotation);
3753
+ needed.delete(annotation.annotationKind);
3754
+ }
3755
+ if (needed.size > 0) {
3756
+ enqueueBasesOf(baseDecl);
3757
+ }
3758
+ }
3759
+ return inherited;
3760
+ }
3761
+ function extractNamedTypeAnnotations(namedDecl, checker, file, extensionRegistry) {
3762
+ const local = extractJSDocAnnotationNodes(namedDecl, file, makeParseOptions(extensionRegistry));
3763
+ const inherited = collectInheritedTypeAnnotations(namedDecl, local, checker, extensionRegistry);
3764
+ if (inherited.length === 0) return [...local];
3765
+ return [...local, ...inherited];
3766
+ }
3531
3767
  function analyzeDeclarationRootInfo(declaration, checker, file = "", extensionRegistry, metadataPolicy) {
3532
3768
  const normalizedMetadataPolicy = createAnalyzerMetadataPolicy(metadataPolicy);
3533
3769
  const declarationType = checker.getTypeAtLocation(declaration);
3534
- const logicalName = ts6.isClassDeclaration(declaration) ? declaration.name?.text ?? "AnonymousClass" : declaration.name.text;
3770
+ const logicalName = ts5.isClassDeclaration(declaration) ? declaration.name?.text ?? "AnonymousClass" : declaration.name.text;
3535
3771
  const docResult = extractJSDocParseResult(
3536
3772
  declaration,
3537
3773
  file,
@@ -3573,13 +3809,19 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
3573
3809
  file,
3574
3810
  makeParseOptions(extensionRegistry, void 0, checker, classType, classType)
3575
3811
  );
3576
- const annotations = [...classDoc.annotations];
3812
+ const inheritedClassAnnotations = collectInheritedTypeAnnotations(
3813
+ classDecl,
3814
+ classDoc.annotations,
3815
+ checker,
3816
+ extensionRegistry
3817
+ );
3818
+ const annotations = [...classDoc.annotations, ...inheritedClassAnnotations];
3577
3819
  diagnostics.push(...classDoc.diagnostics);
3578
3820
  const visiting = /* @__PURE__ */ new Set();
3579
3821
  const instanceMethods = [];
3580
3822
  const staticMethods = [];
3581
3823
  for (const member of classDecl.members) {
3582
- if (ts6.isPropertyDeclaration(member)) {
3824
+ if (ts5.isPropertyDeclaration(member)) {
3583
3825
  const fieldNode = analyzeFieldToIR(
3584
3826
  member,
3585
3827
  checker,
@@ -3595,10 +3837,10 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
3595
3837
  fields.push(fieldNode);
3596
3838
  fieldLayouts.push({});
3597
3839
  }
3598
- } else if (ts6.isMethodDeclaration(member)) {
3840
+ } else if (ts5.isMethodDeclaration(member)) {
3599
3841
  const methodInfo = analyzeMethod(member, checker);
3600
3842
  if (methodInfo) {
3601
- const isStatic = member.modifiers?.some((m) => m.kind === ts6.SyntaxKind.StaticKeyword);
3843
+ const isStatic = member.modifiers?.some((m) => m.kind === ts5.SyntaxKind.StaticKeyword);
3602
3844
  if (isStatic) {
3603
3845
  staticMethods.push(methodInfo);
3604
3846
  } else {
@@ -3630,6 +3872,7 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
3630
3872
  hostType: classType
3631
3873
  }
3632
3874
  );
3875
+ const deduplicatedDiagnostics = deduplicateDiagnostics(diagnostics);
3633
3876
  return {
3634
3877
  name,
3635
3878
  ...metadata !== void 0 && { metadata },
@@ -3637,7 +3880,7 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
3637
3880
  fieldLayouts,
3638
3881
  typeRegistry,
3639
3882
  ...annotations.length > 0 && { annotations },
3640
- ...diagnostics.length > 0 && { diagnostics },
3883
+ ...deduplicatedDiagnostics.length > 0 && { diagnostics: deduplicatedDiagnostics },
3641
3884
  instanceMethods,
3642
3885
  staticMethods
3643
3886
  };
@@ -3657,11 +3900,20 @@ function analyzeInterfaceToIR(interfaceDecl, checker, file = "", extensionRegist
3657
3900
  file,
3658
3901
  makeParseOptions(extensionRegistry, void 0, checker, interfaceType, interfaceType)
3659
3902
  );
3660
- const annotations = [...interfaceDoc.annotations];
3903
+ const inheritedInterfaceAnnotations = collectInheritedTypeAnnotations(
3904
+ interfaceDecl,
3905
+ interfaceDoc.annotations,
3906
+ checker,
3907
+ extensionRegistry
3908
+ );
3909
+ const annotations = [
3910
+ ...interfaceDoc.annotations,
3911
+ ...inheritedInterfaceAnnotations
3912
+ ];
3661
3913
  diagnostics.push(...interfaceDoc.diagnostics);
3662
3914
  const visiting = /* @__PURE__ */ new Set();
3663
3915
  for (const member of interfaceDecl.members) {
3664
- if (ts6.isPropertySignature(member)) {
3916
+ if (ts5.isPropertySignature(member)) {
3665
3917
  const fieldNode = analyzeInterfacePropertyToIR(
3666
3918
  member,
3667
3919
  checker,
@@ -3702,6 +3954,7 @@ function analyzeInterfaceToIR(interfaceDecl, checker, file = "", extensionRegist
3702
3954
  hostType: interfaceType
3703
3955
  }
3704
3956
  );
3957
+ const deduplicatedDiagnostics = deduplicateDiagnostics(diagnostics);
3705
3958
  return {
3706
3959
  name,
3707
3960
  ...metadata !== void 0 && { metadata },
@@ -3709,7 +3962,7 @@ function analyzeInterfaceToIR(interfaceDecl, checker, file = "", extensionRegist
3709
3962
  fieldLayouts,
3710
3963
  typeRegistry,
3711
3964
  ...annotations.length > 0 && { annotations },
3712
- ...diagnostics.length > 0 && { diagnostics },
3965
+ ...deduplicatedDiagnostics.length > 0 && { diagnostics: deduplicatedDiagnostics },
3713
3966
  instanceMethods: [],
3714
3967
  staticMethods: []
3715
3968
  };
@@ -3719,7 +3972,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
3719
3972
  if (members === null) {
3720
3973
  const sourceFile = typeAlias.getSourceFile();
3721
3974
  const { line } = sourceFile.getLineAndCharacterOfPosition(typeAlias.getStart());
3722
- const kindDesc = ts6.SyntaxKind[typeAlias.type.kind] ?? "unknown";
3975
+ const kindDesc = ts5.SyntaxKind[typeAlias.type.kind] ?? "unknown";
3723
3976
  return {
3724
3977
  ok: false,
3725
3978
  kind: "not-object-like",
@@ -3754,7 +4007,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
3754
4007
  diagnostics.push(...typeAliasDoc.diagnostics);
3755
4008
  const visiting = /* @__PURE__ */ new Set();
3756
4009
  for (const member of members) {
3757
- if (ts6.isPropertySignature(member)) {
4010
+ if (ts5.isPropertySignature(member)) {
3758
4011
  const fieldNode = analyzeInterfacePropertyToIR(
3759
4012
  member,
3760
4013
  checker,
@@ -3794,6 +4047,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
3794
4047
  hostType: aliasType
3795
4048
  }
3796
4049
  );
4050
+ const deduplicatedDiagnostics = deduplicateDiagnostics(diagnostics);
3797
4051
  return {
3798
4052
  ok: true,
3799
4053
  analysis: {
@@ -3803,7 +4057,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
3803
4057
  fieldLayouts: specializedFields.map(() => ({})),
3804
4058
  typeRegistry,
3805
4059
  ...annotations.length > 0 && { annotations },
3806
- ...diagnostics.length > 0 && { diagnostics },
4060
+ ...deduplicatedDiagnostics.length > 0 && { diagnostics: deduplicatedDiagnostics },
3807
4061
  instanceMethods: [],
3808
4062
  staticMethods: []
3809
4063
  }
@@ -3821,20 +4075,20 @@ function makeAnalysisDiagnostic(code, message, primaryLocation, relatedLocations
3821
4075
  function getLeadingParsedTags(node) {
3822
4076
  const sourceFile = node.getSourceFile();
3823
4077
  const sourceText = sourceFile.getFullText();
3824
- const commentRanges = ts6.getLeadingCommentRanges(sourceText, node.getFullStart());
4078
+ const commentRanges = ts5.getLeadingCommentRanges(sourceText, node.getFullStart());
3825
4079
  if (commentRanges === void 0) {
3826
4080
  return [];
3827
4081
  }
3828
4082
  const parsedTags = [];
3829
4083
  for (const range of commentRanges) {
3830
- if (range.kind !== ts6.SyntaxKind.MultiLineCommentTrivia) {
4084
+ if (range.kind !== ts5.SyntaxKind.MultiLineCommentTrivia) {
3831
4085
  continue;
3832
4086
  }
3833
4087
  const commentText = sourceText.slice(range.pos, range.end);
3834
4088
  if (!commentText.startsWith("/**")) {
3835
4089
  continue;
3836
4090
  }
3837
- parsedTags.push(...(0, import_internal5.parseCommentBlock)(commentText, { offset: range.pos }).tags);
4091
+ parsedTags.push(...(0, import_internal6.parseCommentBlock)(commentText, { offset: range.pos }).tags);
3838
4092
  }
3839
4093
  return parsedTags;
3840
4094
  }
@@ -3845,19 +4099,19 @@ function resolveDiscriminatorProperty(node, checker, fieldName) {
3845
4099
  return null;
3846
4100
  }
3847
4101
  const declaration = propertySymbol.valueDeclaration ?? propertySymbol.declarations?.find(
3848
- (candidate) => ts6.isPropertyDeclaration(candidate) || ts6.isPropertySignature(candidate)
4102
+ (candidate) => ts5.isPropertyDeclaration(candidate) || ts5.isPropertySignature(candidate)
3849
4103
  ) ?? propertySymbol.declarations?.[0];
3850
4104
  return {
3851
4105
  declaration,
3852
4106
  type: checker.getTypeOfSymbolAtLocation(propertySymbol, declaration ?? node),
3853
- optional: !!(propertySymbol.flags & ts6.SymbolFlags.Optional) || declaration !== void 0 && "questionToken" in declaration && declaration.questionToken !== void 0
4107
+ optional: !!(propertySymbol.flags & ts5.SymbolFlags.Optional) || declaration !== void 0 && "questionToken" in declaration && declaration.questionToken !== void 0
3854
4108
  };
3855
4109
  }
3856
4110
  function isLocalTypeParameterName(node, typeParameterName) {
3857
4111
  return node.typeParameters?.some((typeParameter) => typeParameter.name.text === typeParameterName) ?? false;
3858
4112
  }
3859
4113
  function isNullishSemanticType(type) {
3860
- if (type.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined | ts6.TypeFlags.Void | ts6.TypeFlags.Unknown | ts6.TypeFlags.Any)) {
4114
+ if (type.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined | ts5.TypeFlags.Void | ts5.TypeFlags.Unknown | ts5.TypeFlags.Any)) {
3861
4115
  return true;
3862
4116
  }
3863
4117
  return type.isUnion() && type.types.some((member) => isNullishSemanticType(member));
@@ -3867,7 +4121,7 @@ function isStringLikeSemanticType(type, checker, seen = /* @__PURE__ */ new Set(
3867
4121
  return false;
3868
4122
  }
3869
4123
  seen.add(type);
3870
- if (type.flags & ts6.TypeFlags.StringLike) {
4124
+ if (type.flags & ts5.TypeFlags.StringLike) {
3871
4125
  return true;
3872
4126
  }
3873
4127
  if (type.isUnion()) {
@@ -3880,13 +4134,13 @@ function isStringLikeSemanticType(type, checker, seen = /* @__PURE__ */ new Set(
3880
4134
  return false;
3881
4135
  }
3882
4136
  function getObjectLikeTypeAliasMembers(typeNode) {
3883
- if (ts6.isParenthesizedTypeNode(typeNode)) {
4137
+ if (ts5.isParenthesizedTypeNode(typeNode)) {
3884
4138
  return getObjectLikeTypeAliasMembers(typeNode.type);
3885
4139
  }
3886
- if (ts6.isTypeLiteralNode(typeNode)) {
4140
+ if (ts5.isTypeLiteralNode(typeNode)) {
3887
4141
  return [...typeNode.members];
3888
4142
  }
3889
- if (ts6.isIntersectionTypeNode(typeNode)) {
4143
+ if (ts5.isIntersectionTypeNode(typeNode)) {
3890
4144
  const members = [];
3891
4145
  for (const intersectionMember of typeNode.types) {
3892
4146
  const resolvedMembers = getObjectLikeTypeAliasMembers(intersectionMember);
@@ -4049,7 +4303,7 @@ function resolveLiteralDiscriminatorPropertyValue(boundType, propertyName, check
4049
4303
  }
4050
4304
  if (propertyType.isUnion()) {
4051
4305
  const nonNullMembers = propertyType.types.filter(
4052
- (member) => !(member.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined))
4306
+ (member) => !(member.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
4053
4307
  );
4054
4308
  if (nonNullMembers.length > 0 && nonNullMembers.every((member) => member.isStringLiteral())) {
4055
4309
  diagnostics.push(
@@ -4098,13 +4352,13 @@ function resolveNamedDiscriminatorDeclaration(type, checker, seen = /* @__PURE__
4098
4352
  seen.add(type);
4099
4353
  const symbol = type.aliasSymbol ?? type.getSymbol();
4100
4354
  if (symbol !== void 0) {
4101
- const aliased = symbol.flags & ts6.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : void 0;
4355
+ const aliased = symbol.flags & ts5.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : void 0;
4102
4356
  const targetSymbol = aliased ?? symbol;
4103
4357
  const declaration = targetSymbol.declarations?.find(
4104
- (candidate) => ts6.isClassDeclaration(candidate) || ts6.isInterfaceDeclaration(candidate) || ts6.isTypeAliasDeclaration(candidate) || ts6.isEnumDeclaration(candidate)
4358
+ (candidate) => ts5.isClassDeclaration(candidate) || ts5.isInterfaceDeclaration(candidate) || ts5.isTypeAliasDeclaration(candidate) || ts5.isEnumDeclaration(candidate)
4105
4359
  );
4106
4360
  if (declaration !== void 0) {
4107
- if (ts6.isTypeAliasDeclaration(declaration) && ts6.isTypeReferenceNode(declaration.type) && checker.getTypeFromTypeNode(declaration.type) !== type) {
4361
+ if (ts5.isTypeAliasDeclaration(declaration) && ts5.isTypeReferenceNode(declaration.type) && checker.getTypeFromTypeNode(declaration.type) !== type) {
4108
4362
  return resolveNamedDiscriminatorDeclaration(
4109
4363
  checker.getTypeFromTypeNode(declaration.type),
4110
4364
  checker,
@@ -4132,7 +4386,7 @@ function resolveDiscriminatorValue(boundType, fieldName, checker, provenance, di
4132
4386
  }
4133
4387
  if (boundType.isUnion()) {
4134
4388
  const nonNullMembers = boundType.types.filter(
4135
- (member) => !(member.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined))
4389
+ (member) => !(member.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
4136
4390
  );
4137
4391
  if (nonNullMembers.every((member) => member.isStringLiteral())) {
4138
4392
  diagnostics.push(
@@ -4177,7 +4431,7 @@ function resolveDiscriminatorValue(boundType, fieldName, checker, provenance, di
4177
4431
  return null;
4178
4432
  }
4179
4433
  function getDeclarationName(node) {
4180
- if (ts6.isClassDeclaration(node) || ts6.isInterfaceDeclaration(node) || ts6.isTypeAliasDeclaration(node) || ts6.isEnumDeclaration(node)) {
4434
+ if (ts5.isClassDeclaration(node) || ts5.isInterfaceDeclaration(node) || ts5.isTypeAliasDeclaration(node) || ts5.isEnumDeclaration(node)) {
4181
4435
  return node.name?.text ?? "anonymous";
4182
4436
  }
4183
4437
  return "anonymous";
@@ -4232,11 +4486,11 @@ function extractReferenceTypeArguments(type, checker, file, typeRegistry, visiti
4232
4486
  if (sourceTypeNode === void 0) {
4233
4487
  return [];
4234
4488
  }
4235
- const unwrapParentheses = (typeNode) => ts6.isParenthesizedTypeNode(typeNode) ? unwrapParentheses(typeNode.type) : typeNode;
4489
+ const unwrapParentheses = (typeNode) => ts5.isParenthesizedTypeNode(typeNode) ? unwrapParentheses(typeNode.type) : typeNode;
4236
4490
  const directTypeNode = unwrapParentheses(sourceTypeNode);
4237
- const referenceTypeNode = ts6.isTypeReferenceNode(directTypeNode) ? directTypeNode : (() => {
4491
+ const referenceTypeNode = ts5.isTypeReferenceNode(directTypeNode) ? directTypeNode : (() => {
4238
4492
  const resolvedTypeNode = resolveAliasedTypeNode(directTypeNode, checker);
4239
- return ts6.isTypeReferenceNode(resolvedTypeNode) ? resolvedTypeNode : null;
4493
+ return ts5.isTypeReferenceNode(resolvedTypeNode) ? resolvedTypeNode : null;
4240
4494
  })();
4241
4495
  if (referenceTypeNode?.typeArguments === void 0) {
4242
4496
  return [];
@@ -4244,7 +4498,7 @@ function extractReferenceTypeArguments(type, checker, file, typeRegistry, visiti
4244
4498
  return referenceTypeNode.typeArguments.map((argumentNode) => {
4245
4499
  const argumentType = checker.getTypeFromTypeNode(argumentNode);
4246
4500
  const baseSymbol = argumentType.aliasSymbol ?? argumentType.getSymbol();
4247
- const argumentSymbol = baseSymbol !== void 0 && baseSymbol.flags & ts6.SymbolFlags.Alias ? checker.getAliasedSymbol(baseSymbol) : baseSymbol;
4501
+ const argumentSymbol = baseSymbol !== void 0 && baseSymbol.flags & ts5.SymbolFlags.Alias ? checker.getAliasedSymbol(baseSymbol) : baseSymbol;
4248
4502
  const argumentDecl = argumentSymbol?.declarations?.[0];
4249
4503
  if (argumentDecl !== void 0 && argumentDecl.getSourceFile().fileName !== file) {
4250
4504
  const argumentName = argumentSymbol?.getName() ?? baseSymbol?.getName();
@@ -4307,7 +4561,7 @@ function applyDiscriminatorToObjectProperties(properties, node, subjectType, che
4307
4561
  );
4308
4562
  }
4309
4563
  function analyzeFieldToIR(prop, checker, file, typeRegistry, visiting, diagnostics, hostType, metadataPolicy, extensionRegistry) {
4310
- if (!ts6.isIdentifier(prop.name)) {
4564
+ if (!ts5.isIdentifier(prop.name)) {
4311
4565
  return null;
4312
4566
  }
4313
4567
  const name = prop.name.text;
@@ -4434,7 +4688,7 @@ function findDuplicateObjectLikeTypeAliasPropertyNames(members) {
4434
4688
  const seen = /* @__PURE__ */ new Set();
4435
4689
  const duplicates = /* @__PURE__ */ new Set();
4436
4690
  for (const member of members) {
4437
- if (!ts6.isPropertySignature(member)) {
4691
+ if (!ts5.isPropertySignature(member)) {
4438
4692
  continue;
4439
4693
  }
4440
4694
  const name = getAnalyzableObjectLikePropertyName(member.name);
@@ -4450,7 +4704,7 @@ function findDuplicateObjectLikeTypeAliasPropertyNames(members) {
4450
4704
  return [...duplicates].sort();
4451
4705
  }
4452
4706
  function getAnalyzableObjectLikePropertyName(name) {
4453
- if (ts6.isIdentifier(name) || ts6.isStringLiteral(name) || ts6.isNumericLiteral(name)) {
4707
+ if (ts5.isIdentifier(name) || ts5.isStringLiteral(name) || ts5.isNumericLiteral(name)) {
4454
4708
  return name.text;
4455
4709
  }
4456
4710
  return null;
@@ -4545,28 +4799,28 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
4545
4799
  if (primitiveAlias) {
4546
4800
  return primitiveAlias;
4547
4801
  }
4548
- if (isIntegerBrandedType(type)) {
4802
+ if ((0, import_internal3._isIntegerBrandedType)(type)) {
4549
4803
  return { kind: "primitive", primitiveKind: "integer" };
4550
4804
  }
4551
- if (type.flags & ts6.TypeFlags.String) {
4805
+ if (type.flags & ts5.TypeFlags.String) {
4552
4806
  return { kind: "primitive", primitiveKind: "string" };
4553
4807
  }
4554
- if (type.flags & ts6.TypeFlags.Number) {
4808
+ if (type.flags & ts5.TypeFlags.Number) {
4555
4809
  return { kind: "primitive", primitiveKind: "number" };
4556
4810
  }
4557
- if (type.flags & (ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral)) {
4811
+ if (type.flags & (ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral)) {
4558
4812
  return { kind: "primitive", primitiveKind: "bigint" };
4559
4813
  }
4560
- if (type.flags & ts6.TypeFlags.Boolean) {
4814
+ if (type.flags & ts5.TypeFlags.Boolean) {
4561
4815
  return { kind: "primitive", primitiveKind: "boolean" };
4562
4816
  }
4563
- if (type.flags & ts6.TypeFlags.Null) {
4817
+ if (type.flags & ts5.TypeFlags.Null) {
4564
4818
  return { kind: "primitive", primitiveKind: "null" };
4565
4819
  }
4566
- if (type.flags & ts6.TypeFlags.Undefined) {
4820
+ if (type.flags & ts5.TypeFlags.Undefined) {
4567
4821
  return { kind: "primitive", primitiveKind: "null" };
4568
4822
  }
4569
- if (type.flags & ts6.TypeFlags.Void) {
4823
+ if (type.flags & ts5.TypeFlags.Void) {
4570
4824
  return { kind: "primitive", primitiveKind: "null" };
4571
4825
  }
4572
4826
  if (type.isStringLiteral()) {
@@ -4653,10 +4907,10 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
4653
4907
  return { kind: "primitive", primitiveKind: "string" };
4654
4908
  }
4655
4909
  function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
4656
- if (!(type.flags & (ts6.TypeFlags.String | ts6.TypeFlags.Number | ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral | ts6.TypeFlags.Boolean | ts6.TypeFlags.Null)) && !isIntegerBrandedType(type)) {
4910
+ if (!(type.flags & (ts5.TypeFlags.String | ts5.TypeFlags.Number | ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral | ts5.TypeFlags.Boolean | ts5.TypeFlags.Null)) && !(0, import_internal3._isIntegerBrandedType)(type)) {
4657
4911
  return null;
4658
4912
  }
4659
- const aliasDecl = type.aliasSymbol?.declarations?.find(ts6.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
4913
+ const aliasDecl = type.aliasSymbol?.declarations?.find(ts5.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
4660
4914
  if (!aliasDecl) {
4661
4915
  return null;
4662
4916
  }
@@ -4667,11 +4921,18 @@ function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiti
4667
4921
  ...extractJSDocConstraintNodes(aliasDecl, file, makeParseOptions(extensionRegistry)),
4668
4922
  ...extractTypeAliasConstraintNodes(aliasDecl.type, checker, file, extensionRegistry)
4669
4923
  ];
4670
- const annotations = extractJSDocAnnotationNodes(
4924
+ const localAnnotations = extractJSDocAnnotationNodes(
4671
4925
  aliasDecl,
4672
4926
  file,
4673
4927
  makeParseOptions(extensionRegistry)
4674
4928
  );
4929
+ const inheritedAnnotations = collectInheritedTypeAnnotations(
4930
+ aliasDecl,
4931
+ localAnnotations,
4932
+ checker,
4933
+ extensionRegistry
4934
+ );
4935
+ const annotations = [...localAnnotations, ...inheritedAnnotations];
4675
4936
  const metadata = resolveNodeMetadata(
4676
4937
  metadataPolicy,
4677
4938
  "type",
@@ -4706,8 +4967,8 @@ function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiti
4706
4967
  return { kind: "reference", name: aliasName, typeArguments: [] };
4707
4968
  }
4708
4969
  function getReferencedTypeAliasDeclaration(sourceNode, checker) {
4709
- const typeNode = sourceNode && (ts6.isPropertyDeclaration(sourceNode) || ts6.isPropertySignature(sourceNode) || ts6.isParameter(sourceNode)) ? sourceNode.type : void 0;
4710
- if (!typeNode || !ts6.isTypeReferenceNode(typeNode)) {
4970
+ const typeNode = sourceNode && (ts5.isPropertyDeclaration(sourceNode) || ts5.isPropertySignature(sourceNode) || ts5.isParameter(sourceNode)) ? sourceNode.type : void 0;
4971
+ if (!typeNode || !ts5.isTypeReferenceNode(typeNode)) {
4711
4972
  return void 0;
4712
4973
  }
4713
4974
  return getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -4728,7 +4989,7 @@ function resolveNamedTypeWithSourceRecovery(type, sourceNode, checker) {
4728
4989
  return { typeName: refAliasDecl.name.text, namedDecl: refAliasDecl };
4729
4990
  }
4730
4991
  function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
4731
- if (!ts6.isTypeReferenceNode(typeNode)) {
4992
+ if (!ts5.isTypeReferenceNode(typeNode)) {
4732
4993
  return false;
4733
4994
  }
4734
4995
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -4736,10 +4997,10 @@ function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
4736
4997
  return false;
4737
4998
  }
4738
4999
  const resolved = checker.getTypeFromTypeNode(aliasDecl.type);
4739
- return !!(resolved.flags & (ts6.TypeFlags.String | ts6.TypeFlags.Number | ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral | ts6.TypeFlags.Boolean | ts6.TypeFlags.Null));
5000
+ return !!(resolved.flags & (ts5.TypeFlags.String | ts5.TypeFlags.Number | ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral | ts5.TypeFlags.Boolean | ts5.TypeFlags.Null));
4740
5001
  }
4741
5002
  function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiting, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics, visitedAliases = /* @__PURE__ */ new Set()) {
4742
- const nestedAliasDecl = type.aliasSymbol?.declarations?.find(ts6.isTypeAliasDeclaration);
5003
+ const nestedAliasDecl = type.aliasSymbol?.declarations?.find(ts5.isTypeAliasDeclaration);
4743
5004
  if (nestedAliasDecl !== void 0 && !visitedAliases.has(nestedAliasDecl)) {
4744
5005
  visitedAliases.add(nestedAliasDecl);
4745
5006
  return resolveAliasedPrimitiveTarget(
@@ -4754,22 +5015,22 @@ function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiti
4754
5015
  visitedAliases
4755
5016
  );
4756
5017
  }
4757
- if (isIntegerBrandedType(type)) {
5018
+ if ((0, import_internal3._isIntegerBrandedType)(type)) {
4758
5019
  return { kind: "primitive", primitiveKind: "integer" };
4759
5020
  }
4760
- if (type.flags & ts6.TypeFlags.String) {
5021
+ if (type.flags & ts5.TypeFlags.String) {
4761
5022
  return { kind: "primitive", primitiveKind: "string" };
4762
5023
  }
4763
- if (type.flags & ts6.TypeFlags.Number) {
5024
+ if (type.flags & ts5.TypeFlags.Number) {
4764
5025
  return { kind: "primitive", primitiveKind: "number" };
4765
5026
  }
4766
- if (type.flags & (ts6.TypeFlags.BigInt | ts6.TypeFlags.BigIntLiteral)) {
5027
+ if (type.flags & (ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral)) {
4767
5028
  return { kind: "primitive", primitiveKind: "bigint" };
4768
5029
  }
4769
- if (type.flags & ts6.TypeFlags.Boolean) {
5030
+ if (type.flags & ts5.TypeFlags.Boolean) {
4770
5031
  return { kind: "primitive", primitiveKind: "boolean" };
4771
5032
  }
4772
- if (type.flags & ts6.TypeFlags.Null) {
5033
+ if (type.flags & ts5.TypeFlags.Null) {
4773
5034
  return { kind: "primitive", primitiveKind: "null" };
4774
5035
  }
4775
5036
  return resolveTypeNode(
@@ -4789,7 +5050,7 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
4789
5050
  let typeName = null;
4790
5051
  let namedDecl;
4791
5052
  if (recovered !== null) {
4792
- const recoveredAliasDecl = ts6.isTypeAliasDeclaration(recovered.namedDecl) ? recovered.namedDecl : void 0;
5053
+ const recoveredAliasDecl = ts5.isTypeAliasDeclaration(recovered.namedDecl) ? recovered.namedDecl : void 0;
4793
5054
  if (recoveredAliasDecl !== void 0) {
4794
5055
  const aliasUnderlyingType = checker.getTypeFromTypeNode(recoveredAliasDecl.type);
4795
5056
  const isNonGeneric = recoveredAliasDecl.typeParameters === void 0 || recoveredAliasDecl.typeParameters.length === 0;
@@ -4811,13 +5072,13 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
4811
5072
  (memberTypeNode) => !isNullishTypeNode(resolveAliasedTypeNode(memberTypeNode, checker))
4812
5073
  );
4813
5074
  const nonNullTypes = allTypes.filter(
4814
- (memberType) => !(memberType.flags & (ts6.TypeFlags.Null | ts6.TypeFlags.Undefined))
5075
+ (memberType) => !(memberType.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
4815
5076
  );
4816
5077
  const nonNullMembers = nonNullTypes.map((memberType, index) => ({
4817
5078
  memberType,
4818
5079
  sourceNode: nonNullSourceNodes.length === nonNullTypes.length ? nonNullSourceNodes[index] : void 0
4819
5080
  }));
4820
- const hasNull = allTypes.some((t) => t.flags & ts6.TypeFlags.Null);
5081
+ const hasNull = allTypes.some((t) => t.flags & ts5.TypeFlags.Null);
4821
5082
  const memberDisplayNames = /* @__PURE__ */ new Map();
4822
5083
  if (namedDecl) {
4823
5084
  for (const [value, label] of extractDisplayNameMetadata(namedDecl).memberDisplayNames) {
@@ -4837,7 +5098,7 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
4837
5098
  if (existing !== void 0 && existing.type !== RESOLVING_TYPE_PLACEHOLDER) {
4838
5099
  return { kind: "reference", name: typeName, typeArguments: [] };
4839
5100
  }
4840
- const annotations = namedDecl ? extractJSDocAnnotationNodes(namedDecl, file, makeParseOptions(extensionRegistry)) : void 0;
5101
+ const annotations = namedDecl ? extractNamedTypeAnnotations(namedDecl, checker, file, extensionRegistry) : void 0;
4841
5102
  const metadata = namedDecl !== void 0 ? resolveNodeMetadata(
4842
5103
  metadataPolicy,
4843
5104
  "type",
@@ -4864,7 +5125,7 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
4864
5125
  const displayName = memberDisplayNames.get(String(value));
4865
5126
  return displayName !== void 0 ? { value, displayName } : { value };
4866
5127
  });
4867
- const isBooleanUnion2 = nonNullTypes.length === 2 && nonNullTypes.every((t) => t.flags & ts6.TypeFlags.BooleanLiteral);
5128
+ const isBooleanUnion2 = nonNullTypes.length === 2 && nonNullTypes.every((t) => t.flags & ts5.TypeFlags.BooleanLiteral);
4868
5129
  if (isBooleanUnion2) {
4869
5130
  const boolNode = { kind: "primitive", primitiveKind: "boolean" };
4870
5131
  const result = hasNull ? {
@@ -4956,7 +5217,7 @@ function tryResolveRecordType(type, checker, file, typeRegistry, visiting, metad
4956
5217
  if (type.getProperties().length > 0) {
4957
5218
  return null;
4958
5219
  }
4959
- const indexInfo = checker.getIndexInfoOfType(type, ts6.IndexKind.String);
5220
+ const indexInfo = checker.getIndexInfoOfType(type, ts5.IndexKind.String);
4960
5221
  if (!indexInfo) {
4961
5222
  return null;
4962
5223
  }
@@ -5004,20 +5265,53 @@ function shouldEmitResolvedObjectProperty(property, declaration) {
5004
5265
  }
5005
5266
  if (declaration !== void 0 && "name" in declaration && declaration.name !== void 0) {
5006
5267
  const name = declaration.name;
5007
- if (ts6.isComputedPropertyName(name) || ts6.isPrivateIdentifier(name)) {
5268
+ if (ts5.isComputedPropertyName(name) || ts5.isPrivateIdentifier(name)) {
5008
5269
  return false;
5009
5270
  }
5010
- if (!ts6.isIdentifier(name) && !ts6.isStringLiteral(name) && !ts6.isNumericLiteral(name)) {
5271
+ if (!ts5.isIdentifier(name) && !ts5.isStringLiteral(name) && !ts5.isNumericLiteral(name)) {
5011
5272
  return false;
5012
5273
  }
5013
5274
  }
5014
5275
  return true;
5015
5276
  }
5277
+ function getPassThroughTypeAliasFromSourceNode(sourceNode, checker, extensionRegistry, resolvedTypeName) {
5278
+ const aliasDecl = getReferencedTypeAliasDeclaration(sourceNode, checker);
5279
+ if (!aliasDecl) return void 0;
5280
+ const aliasName = aliasDecl.name.text;
5281
+ if (aliasName === resolvedTypeName) return void 0;
5282
+ if (!ts5.isTypeReferenceNode(aliasDecl.type)) return void 0;
5283
+ if (!hasInheritableTypeAnnotation(aliasDecl, checker, extensionRegistry)) {
5284
+ return void 0;
5285
+ }
5286
+ return { aliasName, aliasDecl };
5287
+ }
5288
+ function hasInheritableTypeAnnotation(aliasDecl, checker, extensionRegistry) {
5289
+ const file = aliasDecl.getSourceFile().fileName;
5290
+ const local = extractJSDocAnnotationNodes(aliasDecl, file, makeParseOptions(extensionRegistry));
5291
+ for (const annotation of local) {
5292
+ if (!INHERITABLE_TYPE_ANNOTATION_KINDS.has(annotation.annotationKind)) continue;
5293
+ if (!isOverridingInheritableAnnotation(annotation)) continue;
5294
+ return true;
5295
+ }
5296
+ const inherited = collectInheritedTypeAnnotations(aliasDecl, local, checker, extensionRegistry);
5297
+ for (const annotation of inherited) {
5298
+ if (INHERITABLE_TYPE_ANNOTATION_KINDS.has(annotation.annotationKind)) return true;
5299
+ }
5300
+ return false;
5301
+ }
5016
5302
  function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
5017
5303
  const collectedDiagnostics = diagnostics ?? [];
5018
5304
  const typeName = getNamedTypeName(type);
5019
5305
  const namedTypeName = typeName ?? void 0;
5020
5306
  const namedDecl = getNamedTypeDeclaration(type);
5307
+ const passThroughAlias = getPassThroughTypeAliasFromSourceNode(
5308
+ sourceNode,
5309
+ checker,
5310
+ extensionRegistry,
5311
+ namedTypeName
5312
+ );
5313
+ const effectiveTypeName = passThroughAlias?.aliasName ?? namedTypeName;
5314
+ const effectiveNamedDecl = passThroughAlias?.aliasDecl ?? namedDecl;
5021
5315
  const referenceTypeArguments = extractReferenceTypeArguments(
5022
5316
  type,
5023
5317
  checker,
@@ -5029,13 +5323,13 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5029
5323
  extensionRegistry,
5030
5324
  collectedDiagnostics
5031
5325
  );
5032
- const instantiatedTypeName = namedTypeName !== void 0 && referenceTypeArguments.length > 0 ? buildInstantiatedReferenceName(
5033
- namedTypeName,
5326
+ const instantiatedTypeName = effectiveTypeName !== void 0 && referenceTypeArguments.length > 0 ? buildInstantiatedReferenceName(
5327
+ effectiveTypeName,
5034
5328
  referenceTypeArguments.map((argument) => argument.tsType),
5035
5329
  checker
5036
5330
  ) : void 0;
5037
- const registryTypeName = instantiatedTypeName ?? namedTypeName;
5038
- const shouldRegisterNamedType = registryTypeName !== void 0 && !(registryTypeName === "Record" && namedDecl?.getSourceFile().fileName !== file);
5331
+ const registryTypeName = instantiatedTypeName ?? effectiveTypeName;
5332
+ const shouldRegisterNamedType = registryTypeName !== void 0 && !(registryTypeName === "Record" && effectiveNamedDecl?.getSourceFile().fileName !== file);
5039
5333
  const clearNamedTypeRegistration = () => {
5040
5334
  if (registryTypeName === void 0 || !shouldRegisterNamedType) {
5041
5335
  return;
@@ -5056,7 +5350,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5056
5350
  typeRegistry[registryTypeName] = {
5057
5351
  name: registryTypeName,
5058
5352
  type: RESOLVING_TYPE_PLACEHOLDER,
5059
- provenance: provenanceForDeclaration(namedDecl, file)
5353
+ provenance: provenanceForDeclaration(effectiveNamedDecl, file)
5060
5354
  };
5061
5355
  }
5062
5356
  visiting.add(type);
@@ -5088,17 +5382,17 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5088
5382
  clearNamedTypeRegistration();
5089
5383
  return recordNode;
5090
5384
  }
5091
- const annotations = namedDecl ? extractJSDocAnnotationNodes(namedDecl, file, makeParseOptions(extensionRegistry)) : void 0;
5092
- const metadata = namedDecl !== void 0 ? resolveNodeMetadata(
5385
+ const annotations = effectiveNamedDecl ? extractNamedTypeAnnotations(effectiveNamedDecl, checker, file, extensionRegistry) : void 0;
5386
+ const metadata = effectiveNamedDecl !== void 0 ? resolveNodeMetadata(
5093
5387
  metadataPolicy,
5094
5388
  "type",
5095
5389
  registryTypeName,
5096
- namedDecl,
5390
+ effectiveNamedDecl,
5097
5391
  checker,
5098
5392
  extensionRegistry,
5099
5393
  {
5100
5394
  checker,
5101
- declaration: namedDecl,
5395
+ declaration: effectiveNamedDecl,
5102
5396
  subjectType: type
5103
5397
  }
5104
5398
  ) : void 0;
@@ -5107,7 +5401,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5107
5401
  ...metadata !== void 0 && { metadata },
5108
5402
  type: recordNode,
5109
5403
  ...annotations !== void 0 && annotations.length > 0 && { annotations },
5110
- provenance: provenanceForDeclaration(namedDecl, file)
5404
+ provenance: provenanceForDeclaration(effectiveNamedDecl, file)
5111
5405
  };
5112
5406
  return {
5113
5407
  kind: "reference",
@@ -5133,7 +5427,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5133
5427
  if (!declaration) continue;
5134
5428
  if (!shouldEmitResolvedObjectProperty(prop, declaration)) continue;
5135
5429
  const propType = checker.getTypeOfSymbolAtLocation(prop, declaration);
5136
- const optional = !!(prop.flags & ts6.SymbolFlags.Optional);
5430
+ const optional = !!(prop.flags & ts5.SymbolFlags.Optional);
5137
5431
  const propTypeNode = resolveTypeNode(
5138
5432
  propType,
5139
5433
  checker,
@@ -5146,7 +5440,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5146
5440
  collectedDiagnostics
5147
5441
  );
5148
5442
  const fieldNodeInfo = fieldInfoMap?.get(prop.name);
5149
- const inlineFieldNodeInfo = fieldNodeInfo === void 0 ? ts6.isPropertySignature(declaration) ? analyzeInterfacePropertyToIR(
5443
+ const inlineFieldNodeInfo = fieldNodeInfo === void 0 ? ts5.isPropertySignature(declaration) ? analyzeInterfacePropertyToIR(
5150
5444
  declaration,
5151
5445
  checker,
5152
5446
  file,
@@ -5156,7 +5450,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5156
5450
  type,
5157
5451
  metadataPolicy,
5158
5452
  extensionRegistry
5159
- ) : ts6.isPropertyDeclaration(declaration) ? analyzeFieldToIR(
5453
+ ) : ts5.isPropertyDeclaration(declaration) ? analyzeFieldToIR(
5160
5454
  declaration,
5161
5455
  checker,
5162
5456
  file,
@@ -5184,9 +5478,9 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5184
5478
  visiting.delete(type);
5185
5479
  const objectNode = {
5186
5480
  kind: "object",
5187
- properties: namedDecl !== void 0 && (ts6.isClassDeclaration(namedDecl) || ts6.isInterfaceDeclaration(namedDecl) || ts6.isTypeAliasDeclaration(namedDecl)) ? applyDiscriminatorToObjectProperties(
5481
+ properties: effectiveNamedDecl !== void 0 && (ts5.isClassDeclaration(effectiveNamedDecl) || ts5.isInterfaceDeclaration(effectiveNamedDecl) || ts5.isTypeAliasDeclaration(effectiveNamedDecl)) ? applyDiscriminatorToObjectProperties(
5188
5482
  properties,
5189
- namedDecl,
5483
+ effectiveNamedDecl,
5190
5484
  type,
5191
5485
  checker,
5192
5486
  file,
@@ -5196,17 +5490,17 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5196
5490
  additionalProperties: true
5197
5491
  };
5198
5492
  if (registryTypeName !== void 0 && shouldRegisterNamedType) {
5199
- const annotations = namedDecl ? extractJSDocAnnotationNodes(namedDecl, file, makeParseOptions(extensionRegistry)) : void 0;
5200
- const metadata = namedDecl !== void 0 ? resolveNodeMetadata(
5493
+ const annotations = effectiveNamedDecl ? extractNamedTypeAnnotations(effectiveNamedDecl, checker, file, extensionRegistry) : void 0;
5494
+ const metadata = effectiveNamedDecl !== void 0 ? resolveNodeMetadata(
5201
5495
  metadataPolicy,
5202
5496
  "type",
5203
5497
  registryTypeName,
5204
- namedDecl,
5498
+ effectiveNamedDecl,
5205
5499
  checker,
5206
5500
  extensionRegistry,
5207
5501
  {
5208
5502
  checker,
5209
- declaration: namedDecl,
5503
+ declaration: effectiveNamedDecl,
5210
5504
  subjectType: type
5211
5505
  }
5212
5506
  ) : void 0;
@@ -5215,7 +5509,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
5215
5509
  ...metadata !== void 0 && { metadata },
5216
5510
  type: objectNode,
5217
5511
  ...annotations !== void 0 && annotations.length > 0 && { annotations },
5218
- provenance: provenanceForDeclaration(namedDecl, file)
5512
+ provenance: provenanceForDeclaration(effectiveNamedDecl, file)
5219
5513
  };
5220
5514
  return {
5221
5515
  kind: "reference",
@@ -5232,12 +5526,12 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
5232
5526
  for (const symbol of symbols) {
5233
5527
  const declarations = symbol.declarations;
5234
5528
  if (!declarations) continue;
5235
- const classDecl = declarations.find(ts6.isClassDeclaration);
5529
+ const classDecl = declarations.find(ts5.isClassDeclaration);
5236
5530
  if (classDecl) {
5237
5531
  const map = /* @__PURE__ */ new Map();
5238
5532
  const hostType = checker.getTypeAtLocation(classDecl);
5239
5533
  for (const member of classDecl.members) {
5240
- if (ts6.isPropertyDeclaration(member) && ts6.isIdentifier(member.name)) {
5534
+ if (ts5.isPropertyDeclaration(member) && ts5.isIdentifier(member.name)) {
5241
5535
  const fieldNode = analyzeFieldToIR(
5242
5536
  member,
5243
5537
  checker,
@@ -5261,7 +5555,7 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
5261
5555
  }
5262
5556
  return map;
5263
5557
  }
5264
- const interfaceDecl = declarations.find(ts6.isInterfaceDeclaration);
5558
+ const interfaceDecl = declarations.find(ts5.isInterfaceDeclaration);
5265
5559
  if (interfaceDecl) {
5266
5560
  return buildFieldNodeInfoMap(
5267
5561
  interfaceDecl.members,
@@ -5275,7 +5569,7 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
5275
5569
  extensionRegistry
5276
5570
  );
5277
5571
  }
5278
- const typeAliasDecl = declarations.find(ts6.isTypeAliasDeclaration);
5572
+ const typeAliasDecl = declarations.find(ts5.isTypeAliasDeclaration);
5279
5573
  const typeAliasMembers = typeAliasDecl === void 0 ? null : getObjectLikeTypeAliasMembers(typeAliasDecl.type);
5280
5574
  if (typeAliasDecl && typeAliasMembers !== null) {
5281
5575
  return buildFieldNodeInfoMap(
@@ -5299,10 +5593,10 @@ function extractArrayElementTypeNode(sourceNode, checker) {
5299
5593
  return void 0;
5300
5594
  }
5301
5595
  const resolvedTypeNode = resolveAliasedTypeNode(typeNode, checker);
5302
- if (ts6.isArrayTypeNode(resolvedTypeNode)) {
5596
+ if (ts5.isArrayTypeNode(resolvedTypeNode)) {
5303
5597
  return resolvedTypeNode.elementType;
5304
5598
  }
5305
- if (ts6.isTypeReferenceNode(resolvedTypeNode) && ts6.isIdentifier(resolvedTypeNode.typeName) && resolvedTypeNode.typeName.text === "Array" && resolvedTypeNode.typeArguments?.[0]) {
5599
+ if (ts5.isTypeReferenceNode(resolvedTypeNode) && ts5.isIdentifier(resolvedTypeNode.typeName) && resolvedTypeNode.typeName.text === "Array" && resolvedTypeNode.typeArguments?.[0]) {
5306
5600
  return resolvedTypeNode.typeArguments[0];
5307
5601
  }
5308
5602
  return void 0;
@@ -5313,13 +5607,13 @@ function extractUnionMemberTypeNodes(sourceNode, checker) {
5313
5607
  return [];
5314
5608
  }
5315
5609
  const resolvedTypeNode = resolveAliasedTypeNode(typeNode, checker);
5316
- return ts6.isUnionTypeNode(resolvedTypeNode) ? [...resolvedTypeNode.types] : [];
5610
+ return ts5.isUnionTypeNode(resolvedTypeNode) ? [...resolvedTypeNode.types] : [];
5317
5611
  }
5318
5612
  function resolveAliasedTypeNode(typeNode, checker, visited = /* @__PURE__ */ new Set()) {
5319
- if (ts6.isParenthesizedTypeNode(typeNode)) {
5613
+ if (ts5.isParenthesizedTypeNode(typeNode)) {
5320
5614
  return resolveAliasedTypeNode(typeNode.type, checker, visited);
5321
5615
  }
5322
- if (!ts6.isTypeReferenceNode(typeNode) || !ts6.isIdentifier(typeNode.typeName)) {
5616
+ if (!ts5.isTypeReferenceNode(typeNode) || !ts5.isIdentifier(typeNode.typeName)) {
5323
5617
  return typeNode;
5324
5618
  }
5325
5619
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -5330,15 +5624,15 @@ function resolveAliasedTypeNode(typeNode, checker, visited = /* @__PURE__ */ new
5330
5624
  return resolveAliasedTypeNode(aliasDecl.type, checker, visited);
5331
5625
  }
5332
5626
  function isNullishTypeNode(typeNode) {
5333
- if (typeNode.kind === ts6.SyntaxKind.NullKeyword || typeNode.kind === ts6.SyntaxKind.UndefinedKeyword) {
5627
+ if (typeNode.kind === ts5.SyntaxKind.NullKeyword || typeNode.kind === ts5.SyntaxKind.UndefinedKeyword) {
5334
5628
  return true;
5335
5629
  }
5336
- return ts6.isLiteralTypeNode(typeNode) && (typeNode.literal.kind === ts6.SyntaxKind.NullKeyword || typeNode.literal.kind === ts6.SyntaxKind.UndefinedKeyword);
5630
+ return ts5.isLiteralTypeNode(typeNode) && (typeNode.literal.kind === ts5.SyntaxKind.NullKeyword || typeNode.literal.kind === ts5.SyntaxKind.UndefinedKeyword);
5337
5631
  }
5338
5632
  function buildFieldNodeInfoMap(members, checker, file, typeRegistry, visiting, metadataPolicy, hostType, diagnostics, extensionRegistry) {
5339
5633
  const map = /* @__PURE__ */ new Map();
5340
5634
  for (const member of members) {
5341
- if (ts6.isPropertySignature(member)) {
5635
+ if (ts5.isPropertySignature(member)) {
5342
5636
  const fieldNode = analyzeInterfacePropertyToIR(
5343
5637
  member,
5344
5638
  checker,
@@ -5363,7 +5657,7 @@ function buildFieldNodeInfoMap(members, checker, file, typeRegistry, visiting, m
5363
5657
  return map;
5364
5658
  }
5365
5659
  function extractTypeAliasConstraintNodes(typeNode, checker, file, extensionRegistry, depth = 0) {
5366
- if (!ts6.isTypeReferenceNode(typeNode)) return [];
5660
+ if (!ts5.isTypeReferenceNode(typeNode)) return [];
5367
5661
  if (depth >= MAX_ALIAS_CHAIN_DEPTH) {
5368
5662
  const aliasName = typeNode.typeName.getText();
5369
5663
  throw new Error(
@@ -5372,7 +5666,7 @@ function extractTypeAliasConstraintNodes(typeNode, checker, file, extensionRegis
5372
5666
  }
5373
5667
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
5374
5668
  if (!aliasDecl) return [];
5375
- if (ts6.isTypeLiteralNode(aliasDecl.type)) return [];
5669
+ if (ts5.isTypeLiteralNode(aliasDecl.type)) return [];
5376
5670
  const aliasFieldType = resolveTypeNode(
5377
5671
  checker.getTypeAtLocation(aliasDecl.type),
5378
5672
  checker,
@@ -5416,14 +5710,14 @@ function getNamedTypeName(type) {
5416
5710
  const symbol = type.getSymbol();
5417
5711
  if (symbol?.declarations) {
5418
5712
  const decl = symbol.declarations[0];
5419
- if (decl && (ts6.isClassDeclaration(decl) || ts6.isInterfaceDeclaration(decl) || ts6.isTypeAliasDeclaration(decl))) {
5420
- const name = ts6.isClassDeclaration(decl) ? decl.name?.text : decl.name.text;
5713
+ if (decl && (ts5.isClassDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isTypeAliasDeclaration(decl))) {
5714
+ const name = ts5.isClassDeclaration(decl) ? decl.name?.text : decl.name.text;
5421
5715
  if (name) return name;
5422
5716
  }
5423
5717
  }
5424
5718
  const aliasSymbol = type.aliasSymbol;
5425
5719
  if (aliasSymbol?.declarations) {
5426
- const aliasDecl = aliasSymbol.declarations.find(ts6.isTypeAliasDeclaration);
5720
+ const aliasDecl = aliasSymbol.declarations.find(ts5.isTypeAliasDeclaration);
5427
5721
  if (aliasDecl) {
5428
5722
  return aliasDecl.name.text;
5429
5723
  }
@@ -5434,24 +5728,24 @@ function getNamedTypeDeclaration(type) {
5434
5728
  const symbol = type.getSymbol();
5435
5729
  if (symbol?.declarations) {
5436
5730
  const decl = symbol.declarations[0];
5437
- if (decl && (ts6.isClassDeclaration(decl) || ts6.isInterfaceDeclaration(decl) || ts6.isTypeAliasDeclaration(decl))) {
5731
+ if (decl && (ts5.isClassDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isTypeAliasDeclaration(decl))) {
5438
5732
  return decl;
5439
5733
  }
5440
5734
  }
5441
5735
  const aliasSymbol = type.aliasSymbol;
5442
5736
  if (aliasSymbol?.declarations) {
5443
- return aliasSymbol.declarations.find(ts6.isTypeAliasDeclaration);
5737
+ return aliasSymbol.declarations.find(ts5.isTypeAliasDeclaration);
5444
5738
  }
5445
5739
  return void 0;
5446
5740
  }
5447
5741
  function analyzeMethod(method, checker) {
5448
- if (!ts6.isIdentifier(method.name)) {
5742
+ if (!ts5.isIdentifier(method.name)) {
5449
5743
  return null;
5450
5744
  }
5451
5745
  const name = method.name.text;
5452
5746
  const parameters = [];
5453
5747
  for (const param of method.parameters) {
5454
- if (ts6.isIdentifier(param.name)) {
5748
+ if (ts5.isIdentifier(param.name)) {
5455
5749
  const paramInfo = analyzeParameter(param, checker);
5456
5750
  parameters.push(paramInfo);
5457
5751
  }
@@ -5462,7 +5756,7 @@ function analyzeMethod(method, checker) {
5462
5756
  return { name, parameters, returnTypeNode, returnType };
5463
5757
  }
5464
5758
  function analyzeParameter(param, checker) {
5465
- const name = ts6.isIdentifier(param.name) ? param.name.text : "param";
5759
+ const name = ts5.isIdentifier(param.name) ? param.name.text : "param";
5466
5760
  const typeNode = param.type;
5467
5761
  const type = checker.getTypeAtLocation(param);
5468
5762
  const formSpecExportName = detectFormSpecReference(typeNode);
@@ -5471,25 +5765,25 @@ function analyzeParameter(param, checker) {
5471
5765
  }
5472
5766
  function detectFormSpecReference(typeNode) {
5473
5767
  if (!typeNode) return null;
5474
- if (!ts6.isTypeReferenceNode(typeNode)) return null;
5475
- const typeName = ts6.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : ts6.isQualifiedName(typeNode.typeName) ? typeNode.typeName.right.text : null;
5768
+ if (!ts5.isTypeReferenceNode(typeNode)) return null;
5769
+ const typeName = ts5.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : ts5.isQualifiedName(typeNode.typeName) ? typeNode.typeName.right.text : null;
5476
5770
  if (typeName !== "InferSchema" && typeName !== "InferFormSchema") return null;
5477
5771
  const typeArg = typeNode.typeArguments?.[0];
5478
- if (!typeArg || !ts6.isTypeQueryNode(typeArg)) return null;
5479
- if (ts6.isIdentifier(typeArg.exprName)) {
5772
+ if (!typeArg || !ts5.isTypeQueryNode(typeArg)) return null;
5773
+ if (ts5.isIdentifier(typeArg.exprName)) {
5480
5774
  return typeArg.exprName.text;
5481
5775
  }
5482
- if (ts6.isQualifiedName(typeArg.exprName)) {
5776
+ if (ts5.isQualifiedName(typeArg.exprName)) {
5483
5777
  return typeArg.exprName.right.text;
5484
5778
  }
5485
5779
  return null;
5486
5780
  }
5487
- var ts6, import_internal5, RESOLVING_TYPE_PLACEHOLDER, MAX_ALIAS_CHAIN_DEPTH;
5781
+ var ts5, import_internal6, RESOLVING_TYPE_PLACEHOLDER, DEDUPLICATABLE_DIAGNOSTIC_CODES, INHERITABLE_TYPE_ANNOTATION_KINDS, MAX_ALIAS_CHAIN_DEPTH;
5488
5782
  var init_class_analyzer = __esm({
5489
5783
  "src/analyzer/class-analyzer.ts"() {
5490
5784
  "use strict";
5491
- ts6 = __toESM(require("typescript"), 1);
5492
- import_internal5 = require("@formspec/analysis/internal");
5785
+ ts5 = __toESM(require("typescript"), 1);
5786
+ import_internal6 = require("@formspec/analysis/internal");
5493
5787
  init_jsdoc_constraints();
5494
5788
  init_tsdoc_parser();
5495
5789
  init_resolve_custom_type();
@@ -5501,6 +5795,11 @@ var init_class_analyzer = __esm({
5501
5795
  properties: [],
5502
5796
  additionalProperties: true
5503
5797
  };
5798
+ DEDUPLICATABLE_DIAGNOSTIC_CODES = /* @__PURE__ */ new Set([
5799
+ "SYNTHETIC_SETUP_FAILURE",
5800
+ "UNSUPPORTED_CUSTOM_TYPE_OVERRIDE"
5801
+ ]);
5802
+ INHERITABLE_TYPE_ANNOTATION_KINDS = /* @__PURE__ */ new Set(["format"]);
5504
5803
  MAX_ALIAS_CHAIN_DEPTH = 8;
5505
5804
  }
5506
5805
  });
@@ -5521,23 +5820,23 @@ function createProgramContextFromProgram(program, filePath) {
5521
5820
  function createProgramContext(filePath, additionalFiles) {
5522
5821
  const absolutePath = path.resolve(filePath);
5523
5822
  const fileDir = path.dirname(absolutePath);
5524
- const configPath = ts7.findConfigFile(fileDir, ts7.sys.fileExists.bind(ts7.sys), "tsconfig.json");
5823
+ const configPath = ts6.findConfigFile(fileDir, ts6.sys.fileExists.bind(ts6.sys), "tsconfig.json");
5525
5824
  let compilerOptions;
5526
5825
  let fileNames;
5527
5826
  if (configPath) {
5528
- const configFile = ts7.readConfigFile(configPath, ts7.sys.readFile.bind(ts7.sys));
5827
+ const configFile = ts6.readConfigFile(configPath, ts6.sys.readFile.bind(ts6.sys));
5529
5828
  if (configFile.error) {
5530
5829
  throw new Error(
5531
- `Error reading tsconfig.json: ${ts7.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`
5830
+ `Error reading tsconfig.json: ${ts6.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`
5532
5831
  );
5533
5832
  }
5534
- const parsed = ts7.parseJsonConfigFileContent(
5833
+ const parsed = ts6.parseJsonConfigFileContent(
5535
5834
  configFile.config,
5536
- ts7.sys,
5835
+ ts6.sys,
5537
5836
  path.dirname(configPath)
5538
5837
  );
5539
5838
  if (parsed.errors.length > 0) {
5540
- const errorMessages = parsed.errors.map((e) => ts7.flattenDiagnosticMessageText(e.messageText, "\n")).join("\n");
5839
+ const errorMessages = parsed.errors.map((e) => ts6.flattenDiagnosticMessageText(e.messageText, "\n")).join("\n");
5541
5840
  throw new Error(`Error parsing tsconfig.json: ${errorMessages}`);
5542
5841
  }
5543
5842
  compilerOptions = parsed.options;
@@ -5545,9 +5844,9 @@ function createProgramContext(filePath, additionalFiles) {
5545
5844
  fileNames = [.../* @__PURE__ */ new Set([...parsed.fileNames, absolutePath, ...normalizedAdditional])];
5546
5845
  } else {
5547
5846
  compilerOptions = {
5548
- target: ts7.ScriptTarget.ES2022,
5549
- module: ts7.ModuleKind.NodeNext,
5550
- moduleResolution: ts7.ModuleResolutionKind.NodeNext,
5847
+ target: ts6.ScriptTarget.ES2022,
5848
+ module: ts6.ModuleKind.NodeNext,
5849
+ moduleResolution: ts6.ModuleResolutionKind.NodeNext,
5551
5850
  strict: true,
5552
5851
  skipLibCheck: true,
5553
5852
  declaration: true
@@ -5555,7 +5854,7 @@ function createProgramContext(filePath, additionalFiles) {
5555
5854
  const normalizedAdditional = (additionalFiles ?? []).map((f) => path.resolve(f));
5556
5855
  fileNames = [.../* @__PURE__ */ new Set([absolutePath, ...normalizedAdditional])];
5557
5856
  }
5558
- const program = ts7.createProgram(fileNames, compilerOptions);
5857
+ const program = ts6.createProgram(fileNames, compilerOptions);
5559
5858
  const sourceFile = program.getSourceFile(absolutePath);
5560
5859
  if (!sourceFile) {
5561
5860
  throw new Error(`Could not find source file: ${absolutePath}`);
@@ -5574,19 +5873,19 @@ function findNodeByName(sourceFile, name, predicate, getName) {
5574
5873
  result = node;
5575
5874
  return;
5576
5875
  }
5577
- ts7.forEachChild(node, visit);
5876
+ ts6.forEachChild(node, visit);
5578
5877
  }
5579
5878
  visit(sourceFile);
5580
5879
  return result;
5581
5880
  }
5582
5881
  function findClassByName(sourceFile, className) {
5583
- return findNodeByName(sourceFile, className, ts7.isClassDeclaration, (n) => n.name?.text);
5882
+ return findNodeByName(sourceFile, className, ts6.isClassDeclaration, (n) => n.name?.text);
5584
5883
  }
5585
5884
  function findInterfaceByName(sourceFile, interfaceName) {
5586
- return findNodeByName(sourceFile, interfaceName, ts7.isInterfaceDeclaration, (n) => n.name.text);
5885
+ return findNodeByName(sourceFile, interfaceName, ts6.isInterfaceDeclaration, (n) => n.name.text);
5587
5886
  }
5588
5887
  function findTypeAliasByName(sourceFile, aliasName) {
5589
- return findNodeByName(sourceFile, aliasName, ts7.isTypeAliasDeclaration, (n) => n.name.text);
5888
+ return findNodeByName(sourceFile, aliasName, ts6.isTypeAliasDeclaration, (n) => n.name.text);
5590
5889
  }
5591
5890
  function getResolvedObjectRootType(rootType, typeRegistry) {
5592
5891
  if (rootType.kind === "object") {
@@ -5626,22 +5925,22 @@ function createResolvedObjectAliasAnalysis(name, rootType, typeRegistry, rootInf
5626
5925
  };
5627
5926
  }
5628
5927
  function containsTypeReferenceInObjectLikeAlias(typeNode) {
5629
- if (ts7.isParenthesizedTypeNode(typeNode)) {
5928
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
5630
5929
  return containsTypeReferenceInObjectLikeAlias(typeNode.type);
5631
5930
  }
5632
- if (ts7.isTypeReferenceNode(typeNode)) {
5931
+ if (ts6.isTypeReferenceNode(typeNode)) {
5633
5932
  return true;
5634
5933
  }
5635
- return ts7.isIntersectionTypeNode(typeNode) && typeNode.types.some((member) => containsTypeReferenceInObjectLikeAlias(member));
5934
+ return ts6.isIntersectionTypeNode(typeNode) && typeNode.types.some((member) => containsTypeReferenceInObjectLikeAlias(member));
5636
5935
  }
5637
5936
  function collectFallbackAliasMemberPropertyNames(typeNode, checker) {
5638
- if (ts7.isParenthesizedTypeNode(typeNode)) {
5937
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
5639
5938
  return collectFallbackAliasMemberPropertyNames(typeNode.type, checker);
5640
5939
  }
5641
- if (ts7.isTypeLiteralNode(typeNode)) {
5940
+ if (ts6.isTypeLiteralNode(typeNode)) {
5642
5941
  const propertyNames = [];
5643
5942
  for (const member of typeNode.members) {
5644
- if (!ts7.isPropertySignature(member)) {
5943
+ if (!ts6.isPropertySignature(member)) {
5645
5944
  continue;
5646
5945
  }
5647
5946
  const propertyName = getAnalyzableObjectLikePropertyName(member.name);
@@ -5651,13 +5950,13 @@ function collectFallbackAliasMemberPropertyNames(typeNode, checker) {
5651
5950
  }
5652
5951
  return propertyNames;
5653
5952
  }
5654
- if (ts7.isTypeReferenceNode(typeNode)) {
5953
+ if (ts6.isTypeReferenceNode(typeNode)) {
5655
5954
  return checker.getTypeFromTypeNode(typeNode).getProperties().map((property) => property.getName());
5656
5955
  }
5657
5956
  return null;
5658
5957
  }
5659
5958
  function findFallbackAliasDuplicatePropertyNames(typeNode, checker) {
5660
- if (!ts7.isIntersectionTypeNode(typeNode)) {
5959
+ if (!ts6.isIntersectionTypeNode(typeNode)) {
5661
5960
  return [];
5662
5961
  }
5663
5962
  const seen = /* @__PURE__ */ new Set();
@@ -5856,11 +6155,11 @@ function makeFileProvenance(filePath) {
5856
6155
  column: 0
5857
6156
  };
5858
6157
  }
5859
- var ts7, path;
6158
+ var ts6, path;
5860
6159
  var init_program = __esm({
5861
6160
  "src/analyzer/program.ts"() {
5862
6161
  "use strict";
5863
- ts7 = __toESM(require("typescript"), 1);
6162
+ ts6 = __toESM(require("typescript"), 1);
5864
6163
  path = __toESM(require("path"), 1);
5865
6164
  init_class_analyzer();
5866
6165
  }
@@ -5875,10 +6174,10 @@ function buildSymbolMapFromConfig(configPath, program, checker, extensionRegistr
5875
6174
  return symbolMap;
5876
6175
  }
5877
6176
  function visit(node) {
5878
- if (ts8.isCallExpression(node) && isDefineCustomTypeCall(node, checker)) {
6177
+ if (ts7.isCallExpression(node) && isDefineCustomTypeCall(node, checker)) {
5879
6178
  processDefineCustomTypeCall(node);
5880
6179
  }
5881
- ts8.forEachChild(node, visit);
6180
+ ts7.forEachChild(node, visit);
5882
6181
  }
5883
6182
  function processDefineCustomTypeCall(call) {
5884
6183
  const typeArgNode = call.typeArguments?.[0];
@@ -5915,7 +6214,7 @@ function isDefineCustomTypeCall(node, checker) {
5915
6214
  if (node.typeArguments === void 0 || node.typeArguments.length === 0) return false;
5916
6215
  const callSymbol = checker.getSymbolAtLocation(node.expression);
5917
6216
  if (callSymbol !== void 0) {
5918
- const resolved = callSymbol.flags & ts8.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
6217
+ const resolved = callSymbol.flags & ts7.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
5919
6218
  const decl = resolved.declarations?.[0];
5920
6219
  if (decl !== void 0) {
5921
6220
  const sourceFile = decl.getSourceFile().fileName.replace(/\\/g, "/");
@@ -5923,24 +6222,24 @@ function isDefineCustomTypeCall(node, checker) {
5923
6222
  (sourceFile.includes("@formspec/core") || sourceFile.includes("/packages/core/"));
5924
6223
  }
5925
6224
  }
5926
- return ts8.isIdentifier(node.expression) && node.expression.text === "defineCustomType";
6225
+ return ts7.isIdentifier(node.expression) && node.expression.text === "defineCustomType";
5927
6226
  }
5928
6227
  function extractTypeNameFromCallArg(call) {
5929
6228
  const arg = call.arguments[0];
5930
- if (arg === void 0 || !ts8.isObjectLiteralExpression(arg)) {
6229
+ if (arg === void 0 || !ts7.isObjectLiteralExpression(arg)) {
5931
6230
  return null;
5932
6231
  }
5933
6232
  const typeNameProp = arg.properties.find(
5934
- (p) => ts8.isPropertyAssignment(p) && ts8.isIdentifier(p.name) && p.name.text === "typeName"
6233
+ (p) => ts7.isPropertyAssignment(p) && ts7.isIdentifier(p.name) && p.name.text === "typeName"
5935
6234
  );
5936
- if (typeNameProp === void 0 || !ts8.isStringLiteral(typeNameProp.initializer)) {
6235
+ if (typeNameProp === void 0 || !ts7.isStringLiteral(typeNameProp.initializer)) {
5937
6236
  return null;
5938
6237
  }
5939
6238
  return typeNameProp.initializer.text;
5940
6239
  }
5941
6240
  function extractEnclosingExtensionId(call, checker) {
5942
- for (let node = call.parent; !ts8.isSourceFile(node); node = node.parent) {
5943
- if (ts8.isCallExpression(node) && isDefineExtensionCall(node, checker)) {
6241
+ for (let node = call.parent; !ts7.isSourceFile(node); node = node.parent) {
6242
+ if (ts7.isCallExpression(node) && isDefineExtensionCall(node, checker)) {
5944
6243
  return extractExtensionIdFromCallArg(node);
5945
6244
  }
5946
6245
  }
@@ -5949,24 +6248,24 @@ function extractEnclosingExtensionId(call, checker) {
5949
6248
  function isDefineExtensionCall(node, checker) {
5950
6249
  const callSymbol = checker.getSymbolAtLocation(node.expression);
5951
6250
  if (callSymbol !== void 0) {
5952
- const resolved = callSymbol.flags & ts8.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
6251
+ const resolved = callSymbol.flags & ts7.SymbolFlags.Alias ? checker.getAliasedSymbol(callSymbol) : callSymbol;
5953
6252
  const decl = resolved.declarations?.[0];
5954
6253
  if (decl !== void 0) {
5955
6254
  const sourceFile = decl.getSourceFile().fileName.replace(/\\/g, "/");
5956
6255
  return resolved.name === "defineExtension" && (sourceFile.includes("@formspec/core") || sourceFile.includes("/packages/core/"));
5957
6256
  }
5958
6257
  }
5959
- return ts8.isIdentifier(node.expression) && node.expression.text === "defineExtension";
6258
+ return ts7.isIdentifier(node.expression) && node.expression.text === "defineExtension";
5960
6259
  }
5961
6260
  function extractExtensionIdFromCallArg(call) {
5962
6261
  const arg = call.arguments[0];
5963
- if (arg === void 0 || !ts8.isObjectLiteralExpression(arg)) {
6262
+ if (arg === void 0 || !ts7.isObjectLiteralExpression(arg)) {
5964
6263
  return null;
5965
6264
  }
5966
6265
  const prop = arg.properties.find(
5967
- (p) => ts8.isPropertyAssignment(p) && ts8.isIdentifier(p.name) && p.name.text === "extensionId"
6266
+ (p) => ts7.isPropertyAssignment(p) && ts7.isIdentifier(p.name) && p.name.text === "extensionId"
5968
6267
  );
5969
- if (prop === void 0 || !ts8.isStringLiteral(prop.initializer)) {
6268
+ if (prop === void 0 || !ts7.isStringLiteral(prop.initializer)) {
5970
6269
  return null;
5971
6270
  }
5972
6271
  return prop.initializer.text;
@@ -5984,11 +6283,11 @@ function findRegistrationByTypeName(registry, typeName) {
5984
6283
  }
5985
6284
  return void 0;
5986
6285
  }
5987
- var ts8, path2;
6286
+ var ts7, path2;
5988
6287
  var init_symbol_registry = __esm({
5989
6288
  "src/extensions/symbol-registry.ts"() {
5990
6289
  "use strict";
5991
- ts8 = __toESM(require("typescript"), 1);
6290
+ ts7 = __toESM(require("typescript"), 1);
5992
6291
  path2 = __toESM(require("path"), 1);
5993
6292
  init_ts_type_utils();
5994
6293
  }
@@ -5996,7 +6295,7 @@ var init_symbol_registry = __esm({
5996
6295
 
5997
6296
  // src/validate/constraint-validator.ts
5998
6297
  function validateFieldNode(ctx, field) {
5999
- const analysis = (0, import_internal6.analyzeConstraintTargets)(
6298
+ const analysis = (0, import_internal7.analyzeConstraintTargets)(
6000
6299
  field.name,
6001
6300
  field.type,
6002
6301
  field.constraints,
@@ -6014,7 +6313,7 @@ function validateFieldNode(ctx, field) {
6014
6313
  }
6015
6314
  function validateObjectProperty(ctx, parentName, property) {
6016
6315
  const qualifiedName = `${parentName}.${property.name}`;
6017
- const analysis = (0, import_internal6.analyzeConstraintTargets)(
6316
+ const analysis = (0, import_internal7.analyzeConstraintTargets)(
6018
6317
  qualifiedName,
6019
6318
  property.type,
6020
6319
  property.constraints,
@@ -6065,11 +6364,11 @@ function validateIR(ir, options) {
6065
6364
  valid: ctx.diagnostics.every((diagnostic) => diagnostic.severity !== "error")
6066
6365
  };
6067
6366
  }
6068
- var import_internal6;
6367
+ var import_internal7;
6069
6368
  var init_constraint_validator = __esm({
6070
6369
  "src/validate/constraint-validator.ts"() {
6071
6370
  "use strict";
6072
- import_internal6 = require("@formspec/analysis/internal");
6371
+ import_internal7 = require("@formspec/analysis/internal");
6073
6372
  }
6074
6373
  });
6075
6374
 
@@ -6251,7 +6550,7 @@ function generateSchemasBatch(options) {
6251
6550
  return options.targets.map((target) => {
6252
6551
  let ctx;
6253
6552
  try {
6254
- const cacheKey = ts9.sys.useCaseSensitiveFileNames ? target.filePath : target.filePath.toLowerCase();
6553
+ const cacheKey = ts8.sys.useCaseSensitiveFileNames ? target.filePath : target.filePath.toLowerCase();
6255
6554
  const cachedContext = contextCache.get(cacheKey);
6256
6555
  if (cachedContext === void 0) {
6257
6556
  const additionalFiles = options.configPath !== void 0 ? [options.configPath] : void 0;
@@ -6310,7 +6609,7 @@ function isMutableRegistry(reg) {
6310
6609
  }
6311
6610
  function resolveStaticOptions(options) {
6312
6611
  const legacyRegistry = options.extensionRegistry;
6313
- const configRegistry = legacyRegistry === void 0 && options.config?.extensions !== void 0 ? createExtensionRegistry(options.config.extensions) : void 0;
6612
+ const configRegistry = legacyRegistry === void 0 && options.config?.extensions !== void 0 && options.config.extensions.length > 0 ? createExtensionRegistry(options.config.extensions) : void 0;
6314
6613
  return {
6315
6614
  extensionRegistry: legacyRegistry ?? configRegistry,
6316
6615
  // eslint-disable-next-line @typescript-eslint/no-deprecated -- migration bridge reads deprecated fields
@@ -6322,7 +6621,7 @@ function resolveStaticOptions(options) {
6322
6621
  };
6323
6622
  }
6324
6623
  function resolveOptions(options) {
6325
- const configRegistry = options.config?.extensions !== void 0 ? createExtensionRegistry(options.config.extensions) : void 0;
6624
+ const configRegistry = options.config?.extensions !== void 0 && options.config.extensions.length > 0 ? createExtensionRegistry(options.config.extensions) : void 0;
6326
6625
  const legacyRegistry = options.extensionRegistry;
6327
6626
  return {
6328
6627
  // When the caller provides the deprecated extensionRegistry field directly,
@@ -6405,11 +6704,11 @@ function createProgramContextFailureDiagnostic(filePath, error) {
6405
6704
  relatedLocations: []
6406
6705
  };
6407
6706
  }
6408
- var ts9;
6707
+ var ts8;
6409
6708
  var init_class_schema = __esm({
6410
6709
  "src/generators/class-schema.ts"() {
6411
6710
  "use strict";
6412
- ts9 = __toESM(require("typescript"), 1);
6711
+ ts8 = __toESM(require("typescript"), 1);
6413
6712
  init_program();
6414
6713
  init_class_analyzer();
6415
6714
  init_canonicalize();
@@ -6436,7 +6735,7 @@ function getModuleSymbol(context) {
6436
6735
  return context.checker.getSymbolAtLocation(context.sourceFile) ?? sourceFileWithSymbol.symbol;
6437
6736
  }
6438
6737
  function isSchemaSourceDeclaration(declaration) {
6439
- return ts10.isClassDeclaration(declaration) || ts10.isInterfaceDeclaration(declaration) || ts10.isTypeAliasDeclaration(declaration);
6738
+ return ts9.isClassDeclaration(declaration) || ts9.isInterfaceDeclaration(declaration) || ts9.isTypeAliasDeclaration(declaration);
6440
6739
  }
6441
6740
  function resolveModuleExport(context, exportName = "default") {
6442
6741
  const moduleSymbol = getModuleSymbol(context);
@@ -6447,16 +6746,16 @@ function resolveModuleExport(context, exportName = "default") {
6447
6746
  if (exportSymbol === null) {
6448
6747
  return null;
6449
6748
  }
6450
- return exportSymbol.flags & ts10.SymbolFlags.Alias ? context.checker.getAliasedSymbol(exportSymbol) : exportSymbol;
6749
+ return exportSymbol.flags & ts9.SymbolFlags.Alias ? context.checker.getAliasedSymbol(exportSymbol) : exportSymbol;
6451
6750
  }
6452
6751
  function resolveModuleExportDeclaration(context, exportName = "default") {
6453
6752
  return resolveModuleExport(context, exportName)?.declarations?.find(isSchemaSourceDeclaration) ?? null;
6454
6753
  }
6455
- var ts10;
6754
+ var ts9;
6456
6755
  var init_static_build = __esm({
6457
6756
  "src/static-build.ts"() {
6458
6757
  "use strict";
6459
- ts10 = __toESM(require("typescript"), 1);
6758
+ ts9 = __toESM(require("typescript"), 1);
6460
6759
  init_program();
6461
6760
  }
6462
6761
  });
@@ -6469,17 +6768,17 @@ function toDiscoveredTypeSchemas(result, resolvedMetadata) {
6469
6768
  };
6470
6769
  }
6471
6770
  function isNamedTypeDeclaration(declaration) {
6472
- return ts11.isClassDeclaration(declaration) || ts11.isInterfaceDeclaration(declaration) || ts11.isTypeAliasDeclaration(declaration);
6771
+ return ts10.isClassDeclaration(declaration) || ts10.isInterfaceDeclaration(declaration) || ts10.isTypeAliasDeclaration(declaration);
6473
6772
  }
6474
6773
  function hasConcreteTypeArguments(type, checker) {
6475
6774
  if ("aliasTypeArguments" in type && Array.isArray(type.aliasTypeArguments) && type.aliasTypeArguments.length > 0) {
6476
6775
  return true;
6477
6776
  }
6478
- if ((type.flags & ts11.TypeFlags.Object) === 0) {
6777
+ if ((type.flags & ts10.TypeFlags.Object) === 0) {
6479
6778
  return false;
6480
6779
  }
6481
6780
  const objectType = type;
6482
- if ((objectType.objectFlags & ts11.ObjectFlags.Reference) === 0) {
6781
+ if ((objectType.objectFlags & ts10.ObjectFlags.Reference) === 0) {
6483
6782
  return false;
6484
6783
  }
6485
6784
  return checker.getTypeArguments(objectType).length > 0;
@@ -6492,13 +6791,13 @@ function getNamedTypeDeclaration2(type) {
6492
6791
  return declaration;
6493
6792
  }
6494
6793
  }
6495
- const aliasDeclaration = type.aliasSymbol?.declarations?.find(ts11.isTypeAliasDeclaration);
6794
+ const aliasDeclaration = type.aliasSymbol?.declarations?.find(ts10.isTypeAliasDeclaration);
6496
6795
  return aliasDeclaration;
6497
6796
  }
6498
6797
  function getFallbackName(sourceNode, fallback = "AnonymousType") {
6499
6798
  if (sourceNode !== void 0 && "name" in sourceNode) {
6500
6799
  const namedNode = sourceNode;
6501
- if (namedNode.name !== void 0 && ts11.isIdentifier(namedNode.name)) {
6800
+ if (namedNode.name !== void 0 && ts10.isIdentifier(namedNode.name)) {
6502
6801
  return namedNode.name.text;
6503
6802
  }
6504
6803
  }
@@ -6720,7 +7019,7 @@ function generateSchemasFromResolvedType(options, skipNamedDeclaration = false,
6720
7019
  function generateSchemasFromDeclaration(options) {
6721
7020
  const filePath = options.declaration.getSourceFile().fileName;
6722
7021
  const resolved = resolveStaticOptions(options);
6723
- if (ts11.isClassDeclaration(options.declaration)) {
7022
+ if (ts10.isClassDeclaration(options.declaration)) {
6724
7023
  return generateSchemasFromAnalysis(
6725
7024
  analyzeClassToIR(
6726
7025
  options.declaration,
@@ -6734,7 +7033,7 @@ function generateSchemasFromDeclaration(options) {
6734
7033
  resolved
6735
7034
  );
6736
7035
  }
6737
- if (ts11.isInterfaceDeclaration(options.declaration)) {
7036
+ if (ts10.isInterfaceDeclaration(options.declaration)) {
6738
7037
  return generateSchemasFromAnalysis(
6739
7038
  analyzeInterfaceToIR(
6740
7039
  options.declaration,
@@ -6748,7 +7047,7 @@ function generateSchemasFromDeclaration(options) {
6748
7047
  resolved
6749
7048
  );
6750
7049
  }
6751
- if (ts11.isTypeAliasDeclaration(options.declaration)) {
7050
+ if (ts10.isTypeAliasDeclaration(options.declaration)) {
6752
7051
  const analyzedAlias = analyzeTypeAliasToIR(
6753
7052
  options.declaration,
6754
7053
  options.context.checker,
@@ -6807,7 +7106,7 @@ function generateSchemasFromReturnType(options) {
6807
7106
  const returnType = signature !== void 0 ? options.context.checker.getReturnTypeOfSignature(signature) : options.context.checker.getTypeAtLocation(options.declaration);
6808
7107
  const type = unwrapPromiseType(options.context.checker, returnType);
6809
7108
  const sourceNode = type !== returnType ? unwrapPromiseTypeNode(options.declaration.type) ?? options.declaration.type ?? options.declaration : options.declaration.type ?? options.declaration;
6810
- const fallbackName = options.declaration.name !== void 0 && ts11.isIdentifier(options.declaration.name) ? `${options.declaration.name.text}ReturnType` : "ReturnType";
7109
+ const fallbackName = options.declaration.name !== void 0 && ts10.isIdentifier(options.declaration.name) ? `${options.declaration.name.text}ReturnType` : "ReturnType";
6811
7110
  return generateSchemasFromResolvedType({
6812
7111
  ...options,
6813
7112
  type,
@@ -6817,7 +7116,7 @@ function generateSchemasFromReturnType(options) {
6817
7116
  }
6818
7117
  function resolveDeclarationMetadata(options) {
6819
7118
  const resolved = resolveStaticOptions(options);
6820
- const analysis = (0, import_internal7.analyzeMetadataForNodeWithChecker)({
7119
+ const analysis = (0, import_internal8.analyzeMetadataForNodeWithChecker)({
6821
7120
  checker: options.context.checker,
6822
7121
  node: options.declaration,
6823
7122
  metadata: resolved.metadata,
@@ -6854,21 +7153,21 @@ function unwrapPromiseTypeNode(typeNode) {
6854
7153
  if (typeNode === void 0) {
6855
7154
  return void 0;
6856
7155
  }
6857
- if (ts11.isParenthesizedTypeNode(typeNode)) {
7156
+ if (ts10.isParenthesizedTypeNode(typeNode)) {
6858
7157
  const unwrapped = unwrapPromiseTypeNode(typeNode.type);
6859
7158
  return unwrapped ?? typeNode;
6860
7159
  }
6861
7160
  return isPromiseTypeReferenceNode(typeNode) ? typeNode.typeArguments[0] : typeNode;
6862
7161
  }
6863
7162
  function isPromiseTypeReferenceNode(typeNode) {
6864
- return ts11.isTypeReferenceNode(typeNode) && ts11.isIdentifier(typeNode.typeName) && typeNode.typeName.text === "Promise" && typeNode.typeArguments !== void 0 && typeNode.typeArguments.length > 0;
7163
+ return ts10.isTypeReferenceNode(typeNode) && ts10.isIdentifier(typeNode.typeName) && typeNode.typeName.text === "Promise" && typeNode.typeArguments !== void 0 && typeNode.typeArguments.length > 0;
6865
7164
  }
6866
- var ts11, import_internal7, import_internals6;
7165
+ var ts10, import_internal8, import_internals6;
6867
7166
  var init_discovered_schema = __esm({
6868
7167
  "src/generators/discovered-schema.ts"() {
6869
7168
  "use strict";
6870
- ts11 = __toESM(require("typescript"), 1);
6871
- import_internal7 = require("@formspec/analysis/internal");
7169
+ ts10 = __toESM(require("typescript"), 1);
7170
+ import_internal8 = require("@formspec/analysis/internal");
6872
7171
  init_class_analyzer();
6873
7172
  init_class_schema();
6874
7173
  init_ir_generator();