@formspec/build 0.1.0-alpha.49 → 0.1.0-alpha.50

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/internals.js CHANGED
@@ -791,21 +791,21 @@ function wrapInConditional(field, layout, provenance) {
791
791
  }
792
792
 
793
793
  // src/analyzer/program.ts
794
- import * as ts4 from "typescript";
794
+ import * as ts6 from "typescript";
795
795
  import * as path from "path";
796
796
 
797
797
  // src/analyzer/class-analyzer.ts
798
- import * as ts3 from "typescript";
798
+ import * as ts5 from "typescript";
799
799
  import {
800
800
  analyzeMetadataForNodeWithChecker,
801
801
  parseCommentBlock
802
802
  } from "@formspec/analysis/internal";
803
803
 
804
804
  // src/analyzer/jsdoc-constraints.ts
805
- import * as ts2 from "typescript";
805
+ import * as ts4 from "typescript";
806
806
 
807
807
  // src/analyzer/tsdoc-parser.ts
808
- import * as ts from "typescript";
808
+ import * as ts3 from "typescript";
809
809
  import {
810
810
  checkSyntheticTagApplication,
811
811
  choosePreferredPayloadText,
@@ -827,13 +827,132 @@ import {
827
827
  isBuiltinConstraintName
828
828
  } from "@formspec/core/internals";
829
829
  import "@formspec/core/internals";
830
+
831
+ // src/extensions/resolve-custom-type.ts
832
+ import * as ts2 from "typescript";
833
+ import { stripNullishUnion } from "@formspec/analysis/internal";
834
+
835
+ // src/extensions/ts-type-utils.ts
836
+ import * as ts from "typescript";
837
+ function collectBrandIdentifiers(type) {
838
+ if (!type.isIntersection()) {
839
+ return [];
840
+ }
841
+ const brands = [];
842
+ for (const prop of type.getProperties()) {
843
+ const decl = prop.valueDeclaration ?? prop.declarations?.[0];
844
+ if (decl === void 0) continue;
845
+ if (!ts.isPropertySignature(decl) && !ts.isPropertyDeclaration(decl)) continue;
846
+ if (!ts.isComputedPropertyName(decl.name)) continue;
847
+ if (!ts.isIdentifier(decl.name.expression)) continue;
848
+ brands.push(decl.name.expression.text);
849
+ }
850
+ return brands;
851
+ }
852
+ function resolveCanonicalSymbol(type, checker) {
853
+ const raw = type.aliasSymbol ?? type.getSymbol();
854
+ if (raw === void 0) return void 0;
855
+ return raw.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(raw) : raw;
856
+ }
857
+ function extractTypeNodeFromSource(sourceNode) {
858
+ if (ts.isPropertyDeclaration(sourceNode) || ts.isPropertySignature(sourceNode) || ts.isParameter(sourceNode) || ts.isTypeAliasDeclaration(sourceNode)) {
859
+ return sourceNode.type;
860
+ }
861
+ if (ts.isTypeNode(sourceNode)) {
862
+ return sourceNode;
863
+ }
864
+ return void 0;
865
+ }
866
+ function resolveAliasedSymbol(symbol, checker) {
867
+ if (symbol === void 0) return void 0;
868
+ return symbol.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
869
+ }
870
+ function getTypeAliasDeclarationFromTypeReference(typeNode, checker) {
871
+ const symbol = checker.getSymbolAtLocation(typeNode.typeName);
872
+ return resolveAliasedSymbol(symbol, checker)?.declarations?.find(ts.isTypeAliasDeclaration);
873
+ }
874
+
875
+ // src/extensions/resolve-custom-type.ts
876
+ function getTypeNodeRegistrationName(typeNode) {
877
+ if (ts2.isTypeReferenceNode(typeNode)) {
878
+ return ts2.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : typeNode.typeName.right.text;
879
+ }
880
+ if (ts2.isParenthesizedTypeNode(typeNode)) {
881
+ return getTypeNodeRegistrationName(typeNode.type);
882
+ }
883
+ if (typeNode.kind === ts2.SyntaxKind.BigIntKeyword || typeNode.kind === ts2.SyntaxKind.StringKeyword || typeNode.kind === ts2.SyntaxKind.NumberKeyword || typeNode.kind === ts2.SyntaxKind.BooleanKeyword) {
884
+ return typeNode.getText();
885
+ }
886
+ return null;
887
+ }
888
+ function resolveByNameFromTypeNode(typeNode, registry, checker) {
889
+ if (ts2.isParenthesizedTypeNode(typeNode)) {
890
+ return resolveByNameFromTypeNode(typeNode.type, registry, checker);
891
+ }
892
+ const typeName = getTypeNodeRegistrationName(typeNode);
893
+ if (typeName !== null) {
894
+ const byName = registry.findTypeByName(typeName);
895
+ if (byName !== void 0) {
896
+ return byName;
897
+ }
898
+ }
899
+ if (ts2.isTypeReferenceNode(typeNode) && ts2.isIdentifier(typeNode.typeName)) {
900
+ const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
901
+ if (aliasDecl !== void 0) {
902
+ return resolveByNameFromTypeNode(aliasDecl.type, registry, checker);
903
+ }
904
+ }
905
+ return null;
906
+ }
907
+ function resolveCustomTypeFromTsType(type, checker, registry, sourceNode) {
908
+ if (registry === void 0) {
909
+ return null;
910
+ }
911
+ const stripped = stripNullishUnion(type);
912
+ if (sourceNode !== void 0) {
913
+ const typeNode = extractTypeNodeFromSource(sourceNode);
914
+ if (typeNode !== void 0) {
915
+ const byName = resolveByNameFromTypeNode(typeNode, registry, checker);
916
+ if (byName !== null) {
917
+ return byName;
918
+ }
919
+ }
920
+ } else {
921
+ const typeName = (stripped.aliasSymbol ?? stripped.getSymbol())?.getName();
922
+ if (typeName !== void 0) {
923
+ const byName = registry.findTypeByName(typeName);
924
+ if (byName !== void 0) {
925
+ return byName;
926
+ }
927
+ }
928
+ }
929
+ const canonical = resolveCanonicalSymbol(stripped, checker);
930
+ if (canonical !== void 0) {
931
+ const bySymbol = registry.findTypeBySymbol(canonical);
932
+ if (bySymbol !== void 0) {
933
+ return bySymbol;
934
+ }
935
+ }
936
+ for (const brand of collectBrandIdentifiers(stripped)) {
937
+ const byBrand = registry.findTypeByBrand(brand);
938
+ if (byBrand !== void 0) {
939
+ return byBrand;
940
+ }
941
+ }
942
+ return null;
943
+ }
944
+ function customTypeIdFromLookup(result) {
945
+ return `${result.extensionId}/${result.registration.typeName}`;
946
+ }
947
+
948
+ // src/analyzer/tsdoc-parser.ts
830
949
  function sharedTagValueOptions(options) {
831
950
  return {
832
951
  ...options?.extensionRegistry !== void 0 ? { registry: options.extensionRegistry } : {},
833
952
  ...options?.fieldType !== void 0 ? { fieldType: options.fieldType } : {}
834
953
  };
835
954
  }
836
- var SYNTHETIC_TYPE_FORMAT_FLAGS = ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
955
+ var SYNTHETIC_TYPE_FORMAT_FLAGS = ts3.TypeFormatFlags.NoTruncation | ts3.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope;
837
956
  function getExtensionTypeNames(registry) {
838
957
  if (registry === void 0) {
839
958
  return /* @__PURE__ */ new Set();
@@ -847,23 +966,23 @@ function getExtensionTypeNames(registry) {
847
966
  function collectImportedNames(sourceFile) {
848
967
  const importedNames = /* @__PURE__ */ new Set();
849
968
  for (const statement of sourceFile.statements) {
850
- if (ts.isImportDeclaration(statement) && statement.importClause !== void 0) {
969
+ if (ts3.isImportDeclaration(statement) && statement.importClause !== void 0) {
851
970
  const clause = statement.importClause;
852
971
  if (clause.name !== void 0) {
853
972
  importedNames.add(clause.name.text);
854
973
  }
855
974
  if (clause.namedBindings !== void 0) {
856
- if (ts.isNamedImports(clause.namedBindings)) {
975
+ if (ts3.isNamedImports(clause.namedBindings)) {
857
976
  for (const specifier of clause.namedBindings.elements) {
858
977
  importedNames.add(specifier.name.text);
859
978
  }
860
- } else if (ts.isNamespaceImport(clause.namedBindings)) {
979
+ } else if (ts3.isNamespaceImport(clause.namedBindings)) {
861
980
  importedNames.add(clause.namedBindings.name.text);
862
981
  }
863
982
  }
864
983
  continue;
865
984
  }
866
- if (ts.isImportEqualsDeclaration(statement)) {
985
+ if (ts3.isImportEqualsDeclaration(statement)) {
867
986
  importedNames.add(statement.name.text);
868
987
  }
869
988
  }
@@ -871,13 +990,13 @@ function collectImportedNames(sourceFile) {
871
990
  }
872
991
  function isNonReferenceIdentifier(node) {
873
992
  const parent = node.parent;
874
- if ((ts.isBindingElement(parent) || ts.isClassDeclaration(parent) || ts.isEnumDeclaration(parent) || ts.isEnumMember(parent) || ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(parent) || ts.isImportClause(parent) || ts.isImportEqualsDeclaration(parent) || ts.isImportSpecifier(parent) || ts.isInterfaceDeclaration(parent) || ts.isMethodDeclaration(parent) || ts.isMethodSignature(parent) || ts.isModuleDeclaration(parent) || ts.isNamespaceExport(parent) || ts.isNamespaceImport(parent) || ts.isParameter(parent) || ts.isPropertyDeclaration(parent) || ts.isPropertySignature(parent) || ts.isSetAccessorDeclaration(parent) || ts.isGetAccessorDeclaration(parent) || ts.isTypeAliasDeclaration(parent) || ts.isTypeParameterDeclaration(parent) || ts.isVariableDeclaration(parent)) && parent.name === node) {
993
+ 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) {
875
994
  return true;
876
995
  }
877
- if ((ts.isPropertyAssignment(parent) || ts.isPropertyAccessExpression(parent)) && parent.name === node) {
996
+ if ((ts3.isPropertyAssignment(parent) || ts3.isPropertyAccessExpression(parent)) && parent.name === node) {
878
997
  return true;
879
998
  }
880
- if (ts.isQualifiedName(parent) && parent.right === node) {
999
+ if (ts3.isQualifiedName(parent) && parent.right === node) {
881
1000
  return true;
882
1001
  }
883
1002
  return false;
@@ -891,11 +1010,11 @@ function statementReferencesImportedName(statement, importedNames) {
891
1010
  if (referencesImportedName) {
892
1011
  return;
893
1012
  }
894
- if (ts.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
1013
+ if (ts3.isIdentifier(node) && importedNames.has(node.text) && !isNonReferenceIdentifier(node)) {
895
1014
  referencesImportedName = true;
896
1015
  return;
897
1016
  }
898
- ts.forEachChild(node, visit);
1017
+ ts3.forEachChild(node, visit);
899
1018
  };
900
1019
  visit(statement);
901
1020
  return referencesImportedName;
@@ -906,9 +1025,9 @@ function buildSupportingDeclarations(sourceFile, extensionTypeNames) {
906
1025
  [...importedNames].filter((name) => !extensionTypeNames.has(name))
907
1026
  );
908
1027
  return sourceFile.statements.filter((statement) => {
909
- if (ts.isImportDeclaration(statement)) return false;
910
- if (ts.isImportEqualsDeclaration(statement)) return false;
911
- if (ts.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
1028
+ if (ts3.isImportDeclaration(statement)) return false;
1029
+ if (ts3.isImportEqualsDeclaration(statement)) return false;
1030
+ if (ts3.isExportDeclaration(statement) && statement.moduleSpecifier !== void 0)
912
1031
  return false;
913
1032
  if (statementReferencesImportedName(statement, importedNamesToSkip)) {
914
1033
  return false;
@@ -1006,7 +1125,7 @@ function stripHintNullishUnion(type) {
1006
1125
  return type;
1007
1126
  }
1008
1127
  const nonNullish = type.types.filter(
1009
- (member) => (member.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) === 0
1128
+ (member) => (member.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined)) === 0
1010
1129
  );
1011
1130
  if (nonNullish.length === 1 && nonNullish[0] !== void 0) {
1012
1131
  return nonNullish[0];
@@ -1022,10 +1141,10 @@ function isUserEmittableHintProperty(property, declaration) {
1022
1141
  }
1023
1142
  if ("name" in declaration && declaration.name !== void 0) {
1024
1143
  const name = declaration.name;
1025
- if (ts.isComputedPropertyName(name) || ts.isPrivateIdentifier(name)) {
1144
+ if (ts3.isComputedPropertyName(name) || ts3.isPrivateIdentifier(name)) {
1026
1145
  return false;
1027
1146
  }
1028
- if (!ts.isIdentifier(name) && !ts.isStringLiteral(name) && !ts.isNumericLiteral(name)) {
1147
+ if (!ts3.isIdentifier(name) && !ts3.isStringLiteral(name) && !ts3.isNumericLiteral(name)) {
1029
1148
  return false;
1030
1149
  }
1031
1150
  }
@@ -1197,7 +1316,8 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
1197
1316
  ];
1198
1317
  }
1199
1318
  const target = parsedTag?.target ?? null;
1200
- const hasBroadening = target === null && hasBuiltinConstraintBroadening(tagName, options);
1319
+ let evaluatedType = subjectType;
1320
+ let targetLabel = node.getText(sourceFile);
1201
1321
  if (target !== null) {
1202
1322
  if (target.kind !== "path") {
1203
1323
  return [
@@ -1237,29 +1357,30 @@ function buildCompilerBackedConstraintDiagnostics(node, sourceFile, tagName, par
1237
1357
  )
1238
1358
  ];
1239
1359
  }
1240
- const requiredCapability = definition.capabilities[0];
1241
- if (requiredCapability !== void 0 && !supportsConstraintCapability(resolution.type, checker, requiredCapability)) {
1242
- const actualType = checker.typeToString(resolution.type, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
1243
- return [
1244
- makeDiagnostic(
1245
- "TYPE_MISMATCH",
1246
- `Target "${target.rawText}": constraint "${tagName}" is only valid on ${capabilityLabel(requiredCapability)} targets, but field type is "${actualType}"`,
1247
- provenance
1248
- )
1249
- ];
1360
+ evaluatedType = resolution.type;
1361
+ targetLabel = target.rawText;
1362
+ }
1363
+ const hasBroadening = (() => {
1364
+ if (target === null) {
1365
+ return hasBuiltinConstraintBroadening(tagName, options);
1250
1366
  }
1251
- } else if (!hasBroadening) {
1367
+ const registry = options?.extensionRegistry;
1368
+ if (registry === void 0) return false;
1369
+ const resolved = resolveCustomTypeFromTsType(evaluatedType, checker, registry);
1370
+ return resolved !== null && registry.findBuiltinConstraintBroadening(customTypeIdFromLookup(resolved), tagName) !== void 0;
1371
+ })();
1372
+ if (!hasBroadening) {
1252
1373
  const requiredCapability = definition.capabilities[0];
1253
- if (requiredCapability !== void 0 && !supportsConstraintCapability(subjectType, checker, requiredCapability)) {
1254
- const actualType = checker.typeToString(subjectType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
1255
- const baseMessage = `Target "${node.getText(sourceFile)}": constraint "${tagName}" is only valid on ${capabilityLabel(requiredCapability)} targets, but field type is "${actualType}"`;
1256
- const hint = buildPathTargetHint(
1374
+ if (requiredCapability !== void 0 && !supportsConstraintCapability(evaluatedType, checker, requiredCapability)) {
1375
+ const actualType = checker.typeToString(evaluatedType, node, SYNTHETIC_TYPE_FORMAT_FLAGS);
1376
+ const baseMessage = `Target "${targetLabel}": constraint "${tagName}" is only valid on ${capabilityLabel(requiredCapability)} targets, but field type is "${actualType}"`;
1377
+ const hint = target === null ? buildPathTargetHint(
1257
1378
  subjectType,
1258
1379
  checker,
1259
1380
  requiredCapability,
1260
1381
  tagName,
1261
1382
  parsedTag?.argumentText
1262
- );
1383
+ ) : null;
1263
1384
  return [
1264
1385
  makeDiagnostic(
1265
1386
  "TYPE_MISMATCH",
@@ -1393,12 +1514,12 @@ function parseTSDocTags(node, file = "", options) {
1393
1514
  const sourceText = sourceFile.getFullText();
1394
1515
  const extensionTypeNames = getExtensionTypeNames(options?.extensionRegistry);
1395
1516
  const supportingDeclarations = buildSupportingDeclarations(sourceFile, extensionTypeNames);
1396
- const commentRanges = ts.getLeadingCommentRanges(sourceText, node.getFullStart());
1517
+ const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
1397
1518
  const rawTextFallbacks = collectRawTextFallbacks(node, file);
1398
1519
  const extensionTagNames = getExtensionTagNames(options);
1399
1520
  if (commentRanges) {
1400
1521
  for (const range of commentRanges) {
1401
- if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) {
1522
+ if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) {
1402
1523
  continue;
1403
1524
  }
1404
1525
  const commentText = sourceText.substring(range.pos, range.end);
@@ -1555,10 +1676,10 @@ function extractDisplayNameMetadata(node) {
1555
1676
  const memberDisplayNames = /* @__PURE__ */ new Map();
1556
1677
  const sourceFile = node.getSourceFile();
1557
1678
  const sourceText = sourceFile.getFullText();
1558
- const commentRanges = ts.getLeadingCommentRanges(sourceText, node.getFullStart());
1679
+ const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
1559
1680
  if (commentRanges) {
1560
1681
  for (const range of commentRanges) {
1561
- if (range.kind !== ts.SyntaxKind.MultiLineCommentTrivia) continue;
1682
+ if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) continue;
1562
1683
  const commentText = sourceText.substring(range.pos, range.end);
1563
1684
  if (!commentText.startsWith("/**")) continue;
1564
1685
  const unified = parseUnifiedComment(commentText);
@@ -1583,7 +1704,7 @@ function extractDisplayNameMetadata(node) {
1583
1704
  }
1584
1705
  function collectRawTextFallbacks(node, file) {
1585
1706
  const fallbacks = /* @__PURE__ */ new Map();
1586
- for (const tag of ts.getJSDocTags(node)) {
1707
+ for (const tag of ts3.getJSDocTags(node)) {
1587
1708
  const tagName = normalizeConstraintTagName(tag.tagName.text);
1588
1709
  if (!TAGS_REQUIRING_RAW_TEXT.has(tagName)) continue;
1589
1710
  const commentText = getTagCommentText(tag)?.trim() ?? "";
@@ -1638,7 +1759,7 @@ function getTagCommentText(tag) {
1638
1759
  if (typeof tag.comment === "string") {
1639
1760
  return tag.comment;
1640
1761
  }
1641
- return ts.getTextOfJSDocComment(tag.comment);
1762
+ return ts3.getTextOfJSDocComment(tag.comment);
1642
1763
  }
1643
1764
 
1644
1765
  // src/analyzer/jsdoc-constraints.ts
@@ -1656,18 +1777,18 @@ function extractJSDocAnnotationNodes(node, file = "", options) {
1656
1777
  function extractDefaultValueAnnotation(initializer, file = "") {
1657
1778
  if (!initializer) return null;
1658
1779
  let value;
1659
- if (ts2.isStringLiteral(initializer)) {
1780
+ if (ts4.isStringLiteral(initializer)) {
1660
1781
  value = initializer.text;
1661
- } else if (ts2.isNumericLiteral(initializer)) {
1782
+ } else if (ts4.isNumericLiteral(initializer)) {
1662
1783
  value = Number(initializer.text);
1663
- } else if (initializer.kind === ts2.SyntaxKind.TrueKeyword) {
1784
+ } else if (initializer.kind === ts4.SyntaxKind.TrueKeyword) {
1664
1785
  value = true;
1665
- } else if (initializer.kind === ts2.SyntaxKind.FalseKeyword) {
1786
+ } else if (initializer.kind === ts4.SyntaxKind.FalseKeyword) {
1666
1787
  value = false;
1667
- } else if (initializer.kind === ts2.SyntaxKind.NullKeyword) {
1788
+ } else if (initializer.kind === ts4.SyntaxKind.NullKeyword) {
1668
1789
  value = null;
1669
- } else if (ts2.isPrefixUnaryExpression(initializer)) {
1670
- if (initializer.operator === ts2.SyntaxKind.MinusToken && ts2.isNumericLiteral(initializer.operand)) {
1790
+ } else if (ts4.isPrefixUnaryExpression(initializer)) {
1791
+ if (initializer.operator === ts4.SyntaxKind.MinusToken && ts4.isNumericLiteral(initializer.operand)) {
1671
1792
  value = -Number(initializer.operand.text);
1672
1793
  }
1673
1794
  }
@@ -1689,93 +1810,38 @@ function extractDefaultValueAnnotation(initializer, file = "") {
1689
1810
 
1690
1811
  // src/analyzer/class-analyzer.ts
1691
1812
  function isObjectType(type) {
1692
- return !!(type.flags & ts3.TypeFlags.Object);
1813
+ return !!(type.flags & ts5.TypeFlags.Object);
1693
1814
  }
1694
1815
  function isIntersectionType(type) {
1695
- return !!(type.flags & ts3.TypeFlags.Intersection);
1696
- }
1697
- function collectBrandIdentifiers(type) {
1698
- if (!type.isIntersection()) {
1699
- return [];
1700
- }
1701
- const brands = [];
1702
- for (const prop of type.getProperties()) {
1703
- const decl = prop.valueDeclaration ?? prop.declarations?.[0];
1704
- if (decl === void 0) continue;
1705
- if (!ts3.isPropertySignature(decl) && !ts3.isPropertyDeclaration(decl)) continue;
1706
- if (!ts3.isComputedPropertyName(decl.name)) continue;
1707
- if (!ts3.isIdentifier(decl.name.expression)) continue;
1708
- brands.push(decl.name.expression.text);
1709
- }
1710
- return brands;
1711
- }
1712
- function resolveCanonicalSymbol(type, checker) {
1713
- const raw = type.aliasSymbol ?? type.getSymbol();
1714
- if (raw === void 0) return void 0;
1715
- return raw.flags & ts3.SymbolFlags.Alias ? checker.getAliasedSymbol(raw) : raw;
1716
- }
1717
- function resolveSymbolBasedCustomType(type, extensionRegistry, checker) {
1718
- if (extensionRegistry === void 0) {
1719
- return null;
1720
- }
1721
- const canonical = resolveCanonicalSymbol(type, checker);
1722
- if (canonical === void 0) {
1723
- return null;
1724
- }
1725
- const registration = extensionRegistry.findTypeBySymbol(canonical);
1726
- if (registration === void 0) {
1727
- return null;
1728
- }
1729
- return {
1730
- kind: "custom",
1731
- typeId: `${registration.extensionId}/${registration.registration.typeName}`,
1732
- payload: null
1733
- };
1816
+ return !!(type.flags & ts5.TypeFlags.Intersection);
1734
1817
  }
1735
1818
  function isIntegerBrandedType(type) {
1736
1819
  if (!type.isIntersection()) {
1737
1820
  return false;
1738
1821
  }
1739
- const hasNumberBase = type.types.some((member) => !!(member.flags & ts3.TypeFlags.Number));
1822
+ const hasNumberBase = type.types.some((member) => !!(member.flags & ts5.TypeFlags.Number));
1740
1823
  if (!hasNumberBase) {
1741
1824
  return false;
1742
1825
  }
1743
1826
  return collectBrandIdentifiers(type).includes("__integerBrand");
1744
1827
  }
1745
- function resolveBrandedCustomType(type, extensionRegistry) {
1746
- if (extensionRegistry === void 0) {
1747
- return null;
1748
- }
1749
- for (const brand of collectBrandIdentifiers(type)) {
1750
- const registration = extensionRegistry.findTypeByBrand(brand);
1751
- if (registration === void 0) {
1752
- continue;
1753
- }
1754
- return {
1755
- kind: "custom",
1756
- typeId: `${registration.extensionId}/${registration.registration.typeName}`,
1757
- payload: null
1758
- };
1759
- }
1760
- return null;
1761
- }
1762
1828
  function isResolvableObjectLikeAliasTypeNode(typeNode) {
1763
- if (ts3.isParenthesizedTypeNode(typeNode)) {
1829
+ if (ts5.isParenthesizedTypeNode(typeNode)) {
1764
1830
  return isResolvableObjectLikeAliasTypeNode(typeNode.type);
1765
1831
  }
1766
- if (ts3.isTypeLiteralNode(typeNode) || ts3.isTypeReferenceNode(typeNode)) {
1832
+ if (ts5.isTypeLiteralNode(typeNode) || ts5.isTypeReferenceNode(typeNode)) {
1767
1833
  return true;
1768
1834
  }
1769
- return ts3.isIntersectionTypeNode(typeNode) && typeNode.types.length > 0 && typeNode.types.every((member) => isResolvableObjectLikeAliasTypeNode(member));
1835
+ return ts5.isIntersectionTypeNode(typeNode) && typeNode.types.length > 0 && typeNode.types.every((member) => isResolvableObjectLikeAliasTypeNode(member));
1770
1836
  }
1771
1837
  function isSemanticallyPlainObjectLikeType(type, checker) {
1772
1838
  if (isIntersectionType(type)) {
1773
1839
  return type.types.length > 0 && type.types.every((member) => isSemanticallyPlainObjectLikeType(member, checker));
1774
1840
  }
1775
- return isObjectType(type) && checker.getSignaturesOfType(type, ts3.SignatureKind.Call).length === 0 && checker.getSignaturesOfType(type, ts3.SignatureKind.Construct).length === 0 && !checker.isArrayType(type) && !checker.isTupleType(type);
1841
+ 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);
1776
1842
  }
1777
1843
  function isTypeReference(type) {
1778
- return !!(type.flags & ts3.TypeFlags.Object) && !!(type.objectFlags & ts3.ObjectFlags.Reference);
1844
+ return !!(type.flags & ts5.TypeFlags.Object) && !!(type.objectFlags & ts5.ObjectFlags.Reference);
1779
1845
  }
1780
1846
  var RESOLVING_TYPE_PLACEHOLDER = {
1781
1847
  kind: "object",
@@ -1840,7 +1906,7 @@ function resolveNodeMetadata(metadataPolicy, declarationKind, logicalName, node,
1840
1906
  function analyzeDeclarationRootInfo(declaration, checker, file = "", extensionRegistry, metadataPolicy) {
1841
1907
  const normalizedMetadataPolicy = createAnalyzerMetadataPolicy(metadataPolicy);
1842
1908
  const declarationType = checker.getTypeAtLocation(declaration);
1843
- const logicalName = ts3.isClassDeclaration(declaration) ? declaration.name?.text ?? "AnonymousClass" : declaration.name.text;
1909
+ const logicalName = ts5.isClassDeclaration(declaration) ? declaration.name?.text ?? "AnonymousClass" : declaration.name.text;
1844
1910
  const docResult = extractJSDocParseResult(
1845
1911
  declaration,
1846
1912
  file,
@@ -1888,7 +1954,7 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
1888
1954
  const instanceMethods = [];
1889
1955
  const staticMethods = [];
1890
1956
  for (const member of classDecl.members) {
1891
- if (ts3.isPropertyDeclaration(member)) {
1957
+ if (ts5.isPropertyDeclaration(member)) {
1892
1958
  const fieldNode = analyzeFieldToIR(
1893
1959
  member,
1894
1960
  checker,
@@ -1904,10 +1970,10 @@ function analyzeClassToIR(classDecl, checker, file = "", extensionRegistry, meta
1904
1970
  fields.push(fieldNode);
1905
1971
  fieldLayouts.push({});
1906
1972
  }
1907
- } else if (ts3.isMethodDeclaration(member)) {
1973
+ } else if (ts5.isMethodDeclaration(member)) {
1908
1974
  const methodInfo = analyzeMethod(member, checker);
1909
1975
  if (methodInfo) {
1910
- const isStatic = member.modifiers?.some((m) => m.kind === ts3.SyntaxKind.StaticKeyword);
1976
+ const isStatic = member.modifiers?.some((m) => m.kind === ts5.SyntaxKind.StaticKeyword);
1911
1977
  if (isStatic) {
1912
1978
  staticMethods.push(methodInfo);
1913
1979
  } else {
@@ -1970,7 +2036,7 @@ function analyzeInterfaceToIR(interfaceDecl, checker, file = "", extensionRegist
1970
2036
  diagnostics.push(...interfaceDoc.diagnostics);
1971
2037
  const visiting = /* @__PURE__ */ new Set();
1972
2038
  for (const member of interfaceDecl.members) {
1973
- if (ts3.isPropertySignature(member)) {
2039
+ if (ts5.isPropertySignature(member)) {
1974
2040
  const fieldNode = analyzeInterfacePropertyToIR(
1975
2041
  member,
1976
2042
  checker,
@@ -2028,7 +2094,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
2028
2094
  if (members === null) {
2029
2095
  const sourceFile = typeAlias.getSourceFile();
2030
2096
  const { line } = sourceFile.getLineAndCharacterOfPosition(typeAlias.getStart());
2031
- const kindDesc = ts3.SyntaxKind[typeAlias.type.kind] ?? "unknown";
2097
+ const kindDesc = ts5.SyntaxKind[typeAlias.type.kind] ?? "unknown";
2032
2098
  return {
2033
2099
  ok: false,
2034
2100
  kind: "not-object-like",
@@ -2063,7 +2129,7 @@ function analyzeTypeAliasToIR(typeAlias, checker, file = "", extensionRegistry,
2063
2129
  diagnostics.push(...typeAliasDoc.diagnostics);
2064
2130
  const visiting = /* @__PURE__ */ new Set();
2065
2131
  for (const member of members) {
2066
- if (ts3.isPropertySignature(member)) {
2132
+ if (ts5.isPropertySignature(member)) {
2067
2133
  const fieldNode = analyzeInterfacePropertyToIR(
2068
2134
  member,
2069
2135
  checker,
@@ -2130,13 +2196,13 @@ function makeAnalysisDiagnostic(code, message, primaryLocation, relatedLocations
2130
2196
  function getLeadingParsedTags(node) {
2131
2197
  const sourceFile = node.getSourceFile();
2132
2198
  const sourceText = sourceFile.getFullText();
2133
- const commentRanges = ts3.getLeadingCommentRanges(sourceText, node.getFullStart());
2199
+ const commentRanges = ts5.getLeadingCommentRanges(sourceText, node.getFullStart());
2134
2200
  if (commentRanges === void 0) {
2135
2201
  return [];
2136
2202
  }
2137
2203
  const parsedTags = [];
2138
2204
  for (const range of commentRanges) {
2139
- if (range.kind !== ts3.SyntaxKind.MultiLineCommentTrivia) {
2205
+ if (range.kind !== ts5.SyntaxKind.MultiLineCommentTrivia) {
2140
2206
  continue;
2141
2207
  }
2142
2208
  const commentText = sourceText.slice(range.pos, range.end);
@@ -2154,19 +2220,19 @@ function resolveDiscriminatorProperty(node, checker, fieldName) {
2154
2220
  return null;
2155
2221
  }
2156
2222
  const declaration = propertySymbol.valueDeclaration ?? propertySymbol.declarations?.find(
2157
- (candidate) => ts3.isPropertyDeclaration(candidate) || ts3.isPropertySignature(candidate)
2223
+ (candidate) => ts5.isPropertyDeclaration(candidate) || ts5.isPropertySignature(candidate)
2158
2224
  ) ?? propertySymbol.declarations?.[0];
2159
2225
  return {
2160
2226
  declaration,
2161
2227
  type: checker.getTypeOfSymbolAtLocation(propertySymbol, declaration ?? node),
2162
- optional: !!(propertySymbol.flags & ts3.SymbolFlags.Optional) || declaration !== void 0 && "questionToken" in declaration && declaration.questionToken !== void 0
2228
+ optional: !!(propertySymbol.flags & ts5.SymbolFlags.Optional) || declaration !== void 0 && "questionToken" in declaration && declaration.questionToken !== void 0
2163
2229
  };
2164
2230
  }
2165
2231
  function isLocalTypeParameterName(node, typeParameterName) {
2166
2232
  return node.typeParameters?.some((typeParameter) => typeParameter.name.text === typeParameterName) ?? false;
2167
2233
  }
2168
2234
  function isNullishSemanticType(type) {
2169
- if (type.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined | ts3.TypeFlags.Void | ts3.TypeFlags.Unknown | ts3.TypeFlags.Any)) {
2235
+ if (type.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined | ts5.TypeFlags.Void | ts5.TypeFlags.Unknown | ts5.TypeFlags.Any)) {
2170
2236
  return true;
2171
2237
  }
2172
2238
  return type.isUnion() && type.types.some((member) => isNullishSemanticType(member));
@@ -2176,7 +2242,7 @@ function isStringLikeSemanticType(type, checker, seen = /* @__PURE__ */ new Set(
2176
2242
  return false;
2177
2243
  }
2178
2244
  seen.add(type);
2179
- if (type.flags & ts3.TypeFlags.StringLike) {
2245
+ if (type.flags & ts5.TypeFlags.StringLike) {
2180
2246
  return true;
2181
2247
  }
2182
2248
  if (type.isUnion()) {
@@ -2189,13 +2255,13 @@ function isStringLikeSemanticType(type, checker, seen = /* @__PURE__ */ new Set(
2189
2255
  return false;
2190
2256
  }
2191
2257
  function getObjectLikeTypeAliasMembers(typeNode) {
2192
- if (ts3.isParenthesizedTypeNode(typeNode)) {
2258
+ if (ts5.isParenthesizedTypeNode(typeNode)) {
2193
2259
  return getObjectLikeTypeAliasMembers(typeNode.type);
2194
2260
  }
2195
- if (ts3.isTypeLiteralNode(typeNode)) {
2261
+ if (ts5.isTypeLiteralNode(typeNode)) {
2196
2262
  return [...typeNode.members];
2197
2263
  }
2198
- if (ts3.isIntersectionTypeNode(typeNode)) {
2264
+ if (ts5.isIntersectionTypeNode(typeNode)) {
2199
2265
  const members = [];
2200
2266
  for (const intersectionMember of typeNode.types) {
2201
2267
  const resolvedMembers = getObjectLikeTypeAliasMembers(intersectionMember);
@@ -2358,7 +2424,7 @@ function resolveLiteralDiscriminatorPropertyValue(boundType, propertyName, check
2358
2424
  }
2359
2425
  if (propertyType.isUnion()) {
2360
2426
  const nonNullMembers = propertyType.types.filter(
2361
- (member) => !(member.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined))
2427
+ (member) => !(member.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
2362
2428
  );
2363
2429
  if (nonNullMembers.length > 0 && nonNullMembers.every((member) => member.isStringLiteral())) {
2364
2430
  diagnostics.push(
@@ -2407,13 +2473,13 @@ function resolveNamedDiscriminatorDeclaration(type, checker, seen = /* @__PURE__
2407
2473
  seen.add(type);
2408
2474
  const symbol = type.aliasSymbol ?? type.getSymbol();
2409
2475
  if (symbol !== void 0) {
2410
- const aliased = symbol.flags & ts3.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : void 0;
2476
+ const aliased = symbol.flags & ts5.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : void 0;
2411
2477
  const targetSymbol = aliased ?? symbol;
2412
2478
  const declaration = targetSymbol.declarations?.find(
2413
- (candidate) => ts3.isClassDeclaration(candidate) || ts3.isInterfaceDeclaration(candidate) || ts3.isTypeAliasDeclaration(candidate) || ts3.isEnumDeclaration(candidate)
2479
+ (candidate) => ts5.isClassDeclaration(candidate) || ts5.isInterfaceDeclaration(candidate) || ts5.isTypeAliasDeclaration(candidate) || ts5.isEnumDeclaration(candidate)
2414
2480
  );
2415
2481
  if (declaration !== void 0) {
2416
- if (ts3.isTypeAliasDeclaration(declaration) && ts3.isTypeReferenceNode(declaration.type) && checker.getTypeFromTypeNode(declaration.type) !== type) {
2482
+ if (ts5.isTypeAliasDeclaration(declaration) && ts5.isTypeReferenceNode(declaration.type) && checker.getTypeFromTypeNode(declaration.type) !== type) {
2417
2483
  return resolveNamedDiscriminatorDeclaration(
2418
2484
  checker.getTypeFromTypeNode(declaration.type),
2419
2485
  checker,
@@ -2441,7 +2507,7 @@ function resolveDiscriminatorValue(boundType, fieldName, checker, provenance, di
2441
2507
  }
2442
2508
  if (boundType.isUnion()) {
2443
2509
  const nonNullMembers = boundType.types.filter(
2444
- (member) => !(member.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined))
2510
+ (member) => !(member.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
2445
2511
  );
2446
2512
  if (nonNullMembers.every((member) => member.isStringLiteral())) {
2447
2513
  diagnostics.push(
@@ -2486,7 +2552,7 @@ function resolveDiscriminatorValue(boundType, fieldName, checker, provenance, di
2486
2552
  return null;
2487
2553
  }
2488
2554
  function getDeclarationName(node) {
2489
- if (ts3.isClassDeclaration(node) || ts3.isInterfaceDeclaration(node) || ts3.isTypeAliasDeclaration(node) || ts3.isEnumDeclaration(node)) {
2555
+ if (ts5.isClassDeclaration(node) || ts5.isInterfaceDeclaration(node) || ts5.isTypeAliasDeclaration(node) || ts5.isEnumDeclaration(node)) {
2490
2556
  return node.name?.text ?? "anonymous";
2491
2557
  }
2492
2558
  return "anonymous";
@@ -2541,11 +2607,11 @@ function extractReferenceTypeArguments(type, checker, file, typeRegistry, visiti
2541
2607
  if (sourceTypeNode === void 0) {
2542
2608
  return [];
2543
2609
  }
2544
- const unwrapParentheses = (typeNode) => ts3.isParenthesizedTypeNode(typeNode) ? unwrapParentheses(typeNode.type) : typeNode;
2610
+ const unwrapParentheses = (typeNode) => ts5.isParenthesizedTypeNode(typeNode) ? unwrapParentheses(typeNode.type) : typeNode;
2545
2611
  const directTypeNode = unwrapParentheses(sourceTypeNode);
2546
- const referenceTypeNode = ts3.isTypeReferenceNode(directTypeNode) ? directTypeNode : (() => {
2612
+ const referenceTypeNode = ts5.isTypeReferenceNode(directTypeNode) ? directTypeNode : (() => {
2547
2613
  const resolvedTypeNode = resolveAliasedTypeNode(directTypeNode, checker);
2548
- return ts3.isTypeReferenceNode(resolvedTypeNode) ? resolvedTypeNode : null;
2614
+ return ts5.isTypeReferenceNode(resolvedTypeNode) ? resolvedTypeNode : null;
2549
2615
  })();
2550
2616
  if (referenceTypeNode?.typeArguments === void 0) {
2551
2617
  return [];
@@ -2600,7 +2666,7 @@ function applyDiscriminatorToObjectProperties(properties, node, subjectType, che
2600
2666
  );
2601
2667
  }
2602
2668
  function analyzeFieldToIR(prop, checker, file, typeRegistry, visiting, diagnostics, hostType, metadataPolicy, extensionRegistry) {
2603
- if (!ts3.isIdentifier(prop.name)) {
2669
+ if (!ts5.isIdentifier(prop.name)) {
2604
2670
  return null;
2605
2671
  }
2606
2672
  const name = prop.name.text;
@@ -2727,7 +2793,7 @@ function findDuplicateObjectLikeTypeAliasPropertyNames(members) {
2727
2793
  const seen = /* @__PURE__ */ new Set();
2728
2794
  const duplicates = /* @__PURE__ */ new Set();
2729
2795
  for (const member of members) {
2730
- if (!ts3.isPropertySignature(member)) {
2796
+ if (!ts5.isPropertySignature(member)) {
2731
2797
  continue;
2732
2798
  }
2733
2799
  const name = getAnalyzableObjectLikePropertyName(member.name);
@@ -2743,7 +2809,7 @@ function findDuplicateObjectLikeTypeAliasPropertyNames(members) {
2743
2809
  return [...duplicates].sort();
2744
2810
  }
2745
2811
  function getAnalyzableObjectLikePropertyName(name) {
2746
- if (ts3.isIdentifier(name) || ts3.isStringLiteral(name) || ts3.isNumericLiteral(name)) {
2812
+ if (ts5.isIdentifier(name) || ts5.isStringLiteral(name) || ts5.isNumericLiteral(name)) {
2747
2813
  return name.text;
2748
2814
  }
2749
2815
  return null;
@@ -2810,74 +2876,20 @@ function parseEnumMemberDisplayName(value) {
2810
2876
  if (label === "") return null;
2811
2877
  return { value: match[1], label };
2812
2878
  }
2813
- function resolveRegisteredCustomType(sourceNode, extensionRegistry, checker) {
2814
- if (sourceNode === void 0 || extensionRegistry === void 0) {
2815
- return null;
2816
- }
2817
- const typeNode = extractTypeNodeFromSource(sourceNode);
2818
- if (typeNode === void 0) {
2819
- return null;
2820
- }
2821
- return resolveRegisteredCustomTypeFromTypeNode(typeNode, extensionRegistry, checker);
2822
- }
2823
- function resolveRegisteredCustomTypeFromTypeNode(typeNode, extensionRegistry, checker) {
2824
- if (ts3.isParenthesizedTypeNode(typeNode)) {
2825
- return resolveRegisteredCustomTypeFromTypeNode(typeNode.type, extensionRegistry, checker);
2826
- }
2827
- const typeName = getTypeNodeRegistrationName(typeNode);
2828
- if (typeName === null) {
2829
- return null;
2830
- }
2831
- const registration = extensionRegistry.findTypeByName(typeName);
2832
- if (registration !== void 0) {
2879
+ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
2880
+ const customTypeLookup = resolveCustomTypeFromTsType(
2881
+ type,
2882
+ checker,
2883
+ extensionRegistry,
2884
+ sourceNode
2885
+ );
2886
+ if (customTypeLookup !== null) {
2833
2887
  return {
2834
2888
  kind: "custom",
2835
- typeId: `${registration.extensionId}/${registration.registration.typeName}`,
2889
+ typeId: customTypeIdFromLookup(customTypeLookup),
2836
2890
  payload: null
2837
2891
  };
2838
2892
  }
2839
- if (ts3.isTypeReferenceNode(typeNode) && ts3.isIdentifier(typeNode.typeName)) {
2840
- const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
2841
- if (aliasDecl !== void 0) {
2842
- return resolveRegisteredCustomTypeFromTypeNode(aliasDecl.type, extensionRegistry, checker);
2843
- }
2844
- }
2845
- return null;
2846
- }
2847
- function extractTypeNodeFromSource(sourceNode) {
2848
- if (ts3.isPropertyDeclaration(sourceNode) || ts3.isPropertySignature(sourceNode) || ts3.isParameter(sourceNode) || ts3.isTypeAliasDeclaration(sourceNode)) {
2849
- return sourceNode.type;
2850
- }
2851
- if (ts3.isTypeNode(sourceNode)) {
2852
- return sourceNode;
2853
- }
2854
- return void 0;
2855
- }
2856
- function getTypeNodeRegistrationName(typeNode) {
2857
- if (ts3.isTypeReferenceNode(typeNode)) {
2858
- return ts3.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : typeNode.typeName.right.text;
2859
- }
2860
- if (ts3.isParenthesizedTypeNode(typeNode)) {
2861
- return getTypeNodeRegistrationName(typeNode.type);
2862
- }
2863
- if (typeNode.kind === ts3.SyntaxKind.BigIntKeyword || typeNode.kind === ts3.SyntaxKind.StringKeyword || typeNode.kind === ts3.SyntaxKind.NumberKeyword || typeNode.kind === ts3.SyntaxKind.BooleanKeyword) {
2864
- return typeNode.getText();
2865
- }
2866
- return null;
2867
- }
2868
- function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
2869
- const customType = resolveRegisteredCustomType(sourceNode, extensionRegistry, checker);
2870
- if (customType) {
2871
- return customType;
2872
- }
2873
- const symbolCustomType = resolveSymbolBasedCustomType(type, extensionRegistry, checker);
2874
- if (symbolCustomType) {
2875
- return symbolCustomType;
2876
- }
2877
- const brandedCustomType = resolveBrandedCustomType(type, extensionRegistry);
2878
- if (brandedCustomType) {
2879
- return brandedCustomType;
2880
- }
2881
2893
  const primitiveAlias = tryResolveNamedPrimitiveAlias(
2882
2894
  type,
2883
2895
  checker,
@@ -2895,25 +2907,25 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
2895
2907
  if (isIntegerBrandedType(type)) {
2896
2908
  return { kind: "primitive", primitiveKind: "integer" };
2897
2909
  }
2898
- if (type.flags & ts3.TypeFlags.String) {
2910
+ if (type.flags & ts5.TypeFlags.String) {
2899
2911
  return { kind: "primitive", primitiveKind: "string" };
2900
2912
  }
2901
- if (type.flags & ts3.TypeFlags.Number) {
2913
+ if (type.flags & ts5.TypeFlags.Number) {
2902
2914
  return { kind: "primitive", primitiveKind: "number" };
2903
2915
  }
2904
- if (type.flags & (ts3.TypeFlags.BigInt | ts3.TypeFlags.BigIntLiteral)) {
2916
+ if (type.flags & (ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral)) {
2905
2917
  return { kind: "primitive", primitiveKind: "bigint" };
2906
2918
  }
2907
- if (type.flags & ts3.TypeFlags.Boolean) {
2919
+ if (type.flags & ts5.TypeFlags.Boolean) {
2908
2920
  return { kind: "primitive", primitiveKind: "boolean" };
2909
2921
  }
2910
- if (type.flags & ts3.TypeFlags.Null) {
2922
+ if (type.flags & ts5.TypeFlags.Null) {
2911
2923
  return { kind: "primitive", primitiveKind: "null" };
2912
2924
  }
2913
- if (type.flags & ts3.TypeFlags.Undefined) {
2925
+ if (type.flags & ts5.TypeFlags.Undefined) {
2914
2926
  return { kind: "primitive", primitiveKind: "null" };
2915
2927
  }
2916
- if (type.flags & ts3.TypeFlags.Void) {
2928
+ if (type.flags & ts5.TypeFlags.Void) {
2917
2929
  return { kind: "primitive", primitiveKind: "null" };
2918
2930
  }
2919
2931
  if (type.isStringLiteral()) {
@@ -3000,10 +3012,10 @@ function resolveTypeNode(type, checker, file, typeRegistry, visiting, sourceNode
3000
3012
  return { kind: "primitive", primitiveKind: "string" };
3001
3013
  }
3002
3014
  function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiting, sourceNode, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics) {
3003
- if (!(type.flags & (ts3.TypeFlags.String | ts3.TypeFlags.Number | ts3.TypeFlags.BigInt | ts3.TypeFlags.BigIntLiteral | ts3.TypeFlags.Boolean | ts3.TypeFlags.Null)) && !isIntegerBrandedType(type)) {
3015
+ if (!(type.flags & (ts5.TypeFlags.String | ts5.TypeFlags.Number | ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral | ts5.TypeFlags.Boolean | ts5.TypeFlags.Null)) && !isIntegerBrandedType(type)) {
3004
3016
  return null;
3005
3017
  }
3006
- const aliasDecl = type.aliasSymbol?.declarations?.find(ts3.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
3018
+ const aliasDecl = type.aliasSymbol?.declarations?.find(ts5.isTypeAliasDeclaration) ?? getReferencedTypeAliasDeclaration(sourceNode, checker);
3007
3019
  if (!aliasDecl) {
3008
3020
  return null;
3009
3021
  }
@@ -3053,14 +3065,14 @@ function tryResolveNamedPrimitiveAlias(type, checker, file, typeRegistry, visiti
3053
3065
  return { kind: "reference", name: aliasName, typeArguments: [] };
3054
3066
  }
3055
3067
  function getReferencedTypeAliasDeclaration(sourceNode, checker) {
3056
- const typeNode = sourceNode && (ts3.isPropertyDeclaration(sourceNode) || ts3.isPropertySignature(sourceNode) || ts3.isParameter(sourceNode)) ? sourceNode.type : void 0;
3057
- if (!typeNode || !ts3.isTypeReferenceNode(typeNode)) {
3068
+ const typeNode = sourceNode && (ts5.isPropertyDeclaration(sourceNode) || ts5.isPropertySignature(sourceNode) || ts5.isParameter(sourceNode)) ? sourceNode.type : void 0;
3069
+ if (!typeNode || !ts5.isTypeReferenceNode(typeNode)) {
3058
3070
  return void 0;
3059
3071
  }
3060
3072
  return getTypeAliasDeclarationFromTypeReference(typeNode, checker);
3061
3073
  }
3062
3074
  function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
3063
- if (!ts3.isTypeReferenceNode(typeNode)) {
3075
+ if (!ts5.isTypeReferenceNode(typeNode)) {
3064
3076
  return false;
3065
3077
  }
3066
3078
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -3068,10 +3080,10 @@ function shouldEmitPrimitiveAliasDefinition(typeNode, checker) {
3068
3080
  return false;
3069
3081
  }
3070
3082
  const resolved = checker.getTypeFromTypeNode(aliasDecl.type);
3071
- return !!(resolved.flags & (ts3.TypeFlags.String | ts3.TypeFlags.Number | ts3.TypeFlags.BigInt | ts3.TypeFlags.BigIntLiteral | ts3.TypeFlags.Boolean | ts3.TypeFlags.Null));
3083
+ return !!(resolved.flags & (ts5.TypeFlags.String | ts5.TypeFlags.Number | ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral | ts5.TypeFlags.Boolean | ts5.TypeFlags.Null));
3072
3084
  }
3073
3085
  function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiting, metadataPolicy = createAnalyzerMetadataPolicy(void 0), extensionRegistry, diagnostics, visitedAliases = /* @__PURE__ */ new Set()) {
3074
- const nestedAliasDecl = type.aliasSymbol?.declarations?.find(ts3.isTypeAliasDeclaration);
3086
+ const nestedAliasDecl = type.aliasSymbol?.declarations?.find(ts5.isTypeAliasDeclaration);
3075
3087
  if (nestedAliasDecl !== void 0 && !visitedAliases.has(nestedAliasDecl)) {
3076
3088
  visitedAliases.add(nestedAliasDecl);
3077
3089
  return resolveAliasedPrimitiveTarget(
@@ -3089,19 +3101,19 @@ function resolveAliasedPrimitiveTarget(type, checker, file, typeRegistry, visiti
3089
3101
  if (isIntegerBrandedType(type)) {
3090
3102
  return { kind: "primitive", primitiveKind: "integer" };
3091
3103
  }
3092
- if (type.flags & ts3.TypeFlags.String) {
3104
+ if (type.flags & ts5.TypeFlags.String) {
3093
3105
  return { kind: "primitive", primitiveKind: "string" };
3094
3106
  }
3095
- if (type.flags & ts3.TypeFlags.Number) {
3107
+ if (type.flags & ts5.TypeFlags.Number) {
3096
3108
  return { kind: "primitive", primitiveKind: "number" };
3097
3109
  }
3098
- if (type.flags & (ts3.TypeFlags.BigInt | ts3.TypeFlags.BigIntLiteral)) {
3110
+ if (type.flags & (ts5.TypeFlags.BigInt | ts5.TypeFlags.BigIntLiteral)) {
3099
3111
  return { kind: "primitive", primitiveKind: "bigint" };
3100
3112
  }
3101
- if (type.flags & ts3.TypeFlags.Boolean) {
3113
+ if (type.flags & ts5.TypeFlags.Boolean) {
3102
3114
  return { kind: "primitive", primitiveKind: "boolean" };
3103
3115
  }
3104
- if (type.flags & ts3.TypeFlags.Null) {
3116
+ if (type.flags & ts5.TypeFlags.Null) {
3105
3117
  return { kind: "primitive", primitiveKind: "null" };
3106
3118
  }
3107
3119
  return resolveTypeNode(
@@ -3128,13 +3140,13 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
3128
3140
  (memberTypeNode) => !isNullishTypeNode(resolveAliasedTypeNode(memberTypeNode, checker))
3129
3141
  );
3130
3142
  const nonNullTypes = allTypes.filter(
3131
- (memberType) => !(memberType.flags & (ts3.TypeFlags.Null | ts3.TypeFlags.Undefined))
3143
+ (memberType) => !(memberType.flags & (ts5.TypeFlags.Null | ts5.TypeFlags.Undefined))
3132
3144
  );
3133
3145
  const nonNullMembers = nonNullTypes.map((memberType, index) => ({
3134
3146
  memberType,
3135
3147
  sourceNode: nonNullSourceNodes.length === nonNullTypes.length ? nonNullSourceNodes[index] : void 0
3136
3148
  }));
3137
- const hasNull = allTypes.some((t) => t.flags & ts3.TypeFlags.Null);
3149
+ const hasNull = allTypes.some((t) => t.flags & ts5.TypeFlags.Null);
3138
3150
  const memberDisplayNames = /* @__PURE__ */ new Map();
3139
3151
  if (namedDecl) {
3140
3152
  for (const [value, label] of extractDisplayNameMetadata(namedDecl).memberDisplayNames) {
@@ -3177,7 +3189,7 @@ function resolveUnionType(type, checker, file, typeRegistry, visiting, sourceNod
3177
3189
  const displayName = memberDisplayNames.get(String(value));
3178
3190
  return displayName !== void 0 ? { value, displayName } : { value };
3179
3191
  });
3180
- const isBooleanUnion2 = nonNullTypes.length === 2 && nonNullTypes.every((t) => t.flags & ts3.TypeFlags.BooleanLiteral);
3192
+ const isBooleanUnion2 = nonNullTypes.length === 2 && nonNullTypes.every((t) => t.flags & ts5.TypeFlags.BooleanLiteral);
3181
3193
  if (isBooleanUnion2) {
3182
3194
  const boolNode = { kind: "primitive", primitiveKind: "boolean" };
3183
3195
  const result = hasNull ? {
@@ -3269,7 +3281,7 @@ function tryResolveRecordType(type, checker, file, typeRegistry, visiting, metad
3269
3281
  if (type.getProperties().length > 0) {
3270
3282
  return null;
3271
3283
  }
3272
- const indexInfo = checker.getIndexInfoOfType(type, ts3.IndexKind.String);
3284
+ const indexInfo = checker.getIndexInfoOfType(type, ts5.IndexKind.String);
3273
3285
  if (!indexInfo) {
3274
3286
  return null;
3275
3287
  }
@@ -3317,10 +3329,10 @@ function shouldEmitResolvedObjectProperty(property, declaration) {
3317
3329
  }
3318
3330
  if (declaration !== void 0 && "name" in declaration && declaration.name !== void 0) {
3319
3331
  const name = declaration.name;
3320
- if (ts3.isComputedPropertyName(name) || ts3.isPrivateIdentifier(name)) {
3332
+ if (ts5.isComputedPropertyName(name) || ts5.isPrivateIdentifier(name)) {
3321
3333
  return false;
3322
3334
  }
3323
- if (!ts3.isIdentifier(name) && !ts3.isStringLiteral(name) && !ts3.isNumericLiteral(name)) {
3335
+ if (!ts5.isIdentifier(name) && !ts5.isStringLiteral(name) && !ts5.isNumericLiteral(name)) {
3324
3336
  return false;
3325
3337
  }
3326
3338
  }
@@ -3446,7 +3458,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
3446
3458
  if (!declaration) continue;
3447
3459
  if (!shouldEmitResolvedObjectProperty(prop, declaration)) continue;
3448
3460
  const propType = checker.getTypeOfSymbolAtLocation(prop, declaration);
3449
- const optional = !!(prop.flags & ts3.SymbolFlags.Optional);
3461
+ const optional = !!(prop.flags & ts5.SymbolFlags.Optional);
3450
3462
  const propTypeNode = resolveTypeNode(
3451
3463
  propType,
3452
3464
  checker,
@@ -3459,7 +3471,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
3459
3471
  collectedDiagnostics
3460
3472
  );
3461
3473
  const fieldNodeInfo = fieldInfoMap?.get(prop.name);
3462
- const inlineFieldNodeInfo = fieldNodeInfo === void 0 ? ts3.isPropertySignature(declaration) ? analyzeInterfacePropertyToIR(
3474
+ const inlineFieldNodeInfo = fieldNodeInfo === void 0 ? ts5.isPropertySignature(declaration) ? analyzeInterfacePropertyToIR(
3463
3475
  declaration,
3464
3476
  checker,
3465
3477
  file,
@@ -3469,7 +3481,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
3469
3481
  type,
3470
3482
  metadataPolicy,
3471
3483
  extensionRegistry
3472
- ) : ts3.isPropertyDeclaration(declaration) ? analyzeFieldToIR(
3484
+ ) : ts5.isPropertyDeclaration(declaration) ? analyzeFieldToIR(
3473
3485
  declaration,
3474
3486
  checker,
3475
3487
  file,
@@ -3497,7 +3509,7 @@ function resolveObjectType(type, checker, file, typeRegistry, visiting, sourceNo
3497
3509
  visiting.delete(type);
3498
3510
  const objectNode = {
3499
3511
  kind: "object",
3500
- properties: namedDecl !== void 0 && (ts3.isClassDeclaration(namedDecl) || ts3.isInterfaceDeclaration(namedDecl) || ts3.isTypeAliasDeclaration(namedDecl)) ? applyDiscriminatorToObjectProperties(
3512
+ properties: namedDecl !== void 0 && (ts5.isClassDeclaration(namedDecl) || ts5.isInterfaceDeclaration(namedDecl) || ts5.isTypeAliasDeclaration(namedDecl)) ? applyDiscriminatorToObjectProperties(
3501
3513
  properties,
3502
3514
  namedDecl,
3503
3515
  type,
@@ -3545,12 +3557,12 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
3545
3557
  for (const symbol of symbols) {
3546
3558
  const declarations = symbol.declarations;
3547
3559
  if (!declarations) continue;
3548
- const classDecl = declarations.find(ts3.isClassDeclaration);
3560
+ const classDecl = declarations.find(ts5.isClassDeclaration);
3549
3561
  if (classDecl) {
3550
3562
  const map = /* @__PURE__ */ new Map();
3551
3563
  const hostType = checker.getTypeAtLocation(classDecl);
3552
3564
  for (const member of classDecl.members) {
3553
- if (ts3.isPropertyDeclaration(member) && ts3.isIdentifier(member.name)) {
3565
+ if (ts5.isPropertyDeclaration(member) && ts5.isIdentifier(member.name)) {
3554
3566
  const fieldNode = analyzeFieldToIR(
3555
3567
  member,
3556
3568
  checker,
@@ -3574,7 +3586,7 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
3574
3586
  }
3575
3587
  return map;
3576
3588
  }
3577
- const interfaceDecl = declarations.find(ts3.isInterfaceDeclaration);
3589
+ const interfaceDecl = declarations.find(ts5.isInterfaceDeclaration);
3578
3590
  if (interfaceDecl) {
3579
3591
  return buildFieldNodeInfoMap(
3580
3592
  interfaceDecl.members,
@@ -3588,7 +3600,7 @@ function getNamedTypeFieldNodeInfoMap(type, checker, file, typeRegistry, visitin
3588
3600
  extensionRegistry
3589
3601
  );
3590
3602
  }
3591
- const typeAliasDecl = declarations.find(ts3.isTypeAliasDeclaration);
3603
+ const typeAliasDecl = declarations.find(ts5.isTypeAliasDeclaration);
3592
3604
  const typeAliasMembers = typeAliasDecl === void 0 ? null : getObjectLikeTypeAliasMembers(typeAliasDecl.type);
3593
3605
  if (typeAliasDecl && typeAliasMembers !== null) {
3594
3606
  return buildFieldNodeInfoMap(
@@ -3612,10 +3624,10 @@ function extractArrayElementTypeNode(sourceNode, checker) {
3612
3624
  return void 0;
3613
3625
  }
3614
3626
  const resolvedTypeNode = resolveAliasedTypeNode(typeNode, checker);
3615
- if (ts3.isArrayTypeNode(resolvedTypeNode)) {
3627
+ if (ts5.isArrayTypeNode(resolvedTypeNode)) {
3616
3628
  return resolvedTypeNode.elementType;
3617
3629
  }
3618
- if (ts3.isTypeReferenceNode(resolvedTypeNode) && ts3.isIdentifier(resolvedTypeNode.typeName) && resolvedTypeNode.typeName.text === "Array" && resolvedTypeNode.typeArguments?.[0]) {
3630
+ if (ts5.isTypeReferenceNode(resolvedTypeNode) && ts5.isIdentifier(resolvedTypeNode.typeName) && resolvedTypeNode.typeName.text === "Array" && resolvedTypeNode.typeArguments?.[0]) {
3619
3631
  return resolvedTypeNode.typeArguments[0];
3620
3632
  }
3621
3633
  return void 0;
@@ -3626,13 +3638,13 @@ function extractUnionMemberTypeNodes(sourceNode, checker) {
3626
3638
  return [];
3627
3639
  }
3628
3640
  const resolvedTypeNode = resolveAliasedTypeNode(typeNode, checker);
3629
- return ts3.isUnionTypeNode(resolvedTypeNode) ? [...resolvedTypeNode.types] : [];
3641
+ return ts5.isUnionTypeNode(resolvedTypeNode) ? [...resolvedTypeNode.types] : [];
3630
3642
  }
3631
3643
  function resolveAliasedTypeNode(typeNode, checker, visited = /* @__PURE__ */ new Set()) {
3632
- if (ts3.isParenthesizedTypeNode(typeNode)) {
3644
+ if (ts5.isParenthesizedTypeNode(typeNode)) {
3633
3645
  return resolveAliasedTypeNode(typeNode.type, checker, visited);
3634
3646
  }
3635
- if (!ts3.isTypeReferenceNode(typeNode) || !ts3.isIdentifier(typeNode.typeName)) {
3647
+ if (!ts5.isTypeReferenceNode(typeNode) || !ts5.isIdentifier(typeNode.typeName)) {
3636
3648
  return typeNode;
3637
3649
  }
3638
3650
  const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
@@ -3643,15 +3655,15 @@ function resolveAliasedTypeNode(typeNode, checker, visited = /* @__PURE__ */ new
3643
3655
  return resolveAliasedTypeNode(aliasDecl.type, checker, visited);
3644
3656
  }
3645
3657
  function isNullishTypeNode(typeNode) {
3646
- if (typeNode.kind === ts3.SyntaxKind.NullKeyword || typeNode.kind === ts3.SyntaxKind.UndefinedKeyword) {
3658
+ if (typeNode.kind === ts5.SyntaxKind.NullKeyword || typeNode.kind === ts5.SyntaxKind.UndefinedKeyword) {
3647
3659
  return true;
3648
3660
  }
3649
- return ts3.isLiteralTypeNode(typeNode) && (typeNode.literal.kind === ts3.SyntaxKind.NullKeyword || typeNode.literal.kind === ts3.SyntaxKind.UndefinedKeyword);
3661
+ return ts5.isLiteralTypeNode(typeNode) && (typeNode.literal.kind === ts5.SyntaxKind.NullKeyword || typeNode.literal.kind === ts5.SyntaxKind.UndefinedKeyword);
3650
3662
  }
3651
3663
  function buildFieldNodeInfoMap(members, checker, file, typeRegistry, visiting, metadataPolicy, hostType, diagnostics, extensionRegistry) {
3652
3664
  const map = /* @__PURE__ */ new Map();
3653
3665
  for (const member of members) {
3654
- if (ts3.isPropertySignature(member)) {
3666
+ if (ts5.isPropertySignature(member)) {
3655
3667
  const fieldNode = analyzeInterfacePropertyToIR(
3656
3668
  member,
3657
3669
  checker,
@@ -3677,17 +3689,16 @@ function buildFieldNodeInfoMap(members, checker, file, typeRegistry, visiting, m
3677
3689
  }
3678
3690
  var MAX_ALIAS_CHAIN_DEPTH = 8;
3679
3691
  function extractTypeAliasConstraintNodes(typeNode, checker, file, extensionRegistry, depth = 0) {
3680
- if (!ts3.isTypeReferenceNode(typeNode)) return [];
3692
+ if (!ts5.isTypeReferenceNode(typeNode)) return [];
3681
3693
  if (depth >= MAX_ALIAS_CHAIN_DEPTH) {
3682
3694
  const aliasName = typeNode.typeName.getText();
3683
3695
  throw new Error(
3684
3696
  `Type alias chain exceeds maximum depth of ${String(MAX_ALIAS_CHAIN_DEPTH)} at alias "${aliasName}" in ${file}. Simplify the alias chain or check for circular references.`
3685
3697
  );
3686
3698
  }
3687
- const symbol = checker.getSymbolAtLocation(typeNode.typeName);
3688
- const aliasDecl = getAliasedTypeAliasDeclaration(symbol, checker);
3699
+ const aliasDecl = getTypeAliasDeclarationFromTypeReference(typeNode, checker);
3689
3700
  if (!aliasDecl) return [];
3690
- if (ts3.isTypeLiteralNode(aliasDecl.type)) return [];
3701
+ if (ts5.isTypeLiteralNode(aliasDecl.type)) return [];
3691
3702
  const aliasFieldType = resolveTypeNode(
3692
3703
  checker.getTypeAtLocation(aliasDecl.type),
3693
3704
  checker,
@@ -3708,18 +3719,6 @@ function extractTypeAliasConstraintNodes(typeNode, checker, file, extensionRegis
3708
3719
  );
3709
3720
  return constraints;
3710
3721
  }
3711
- function getAliasedSymbol(symbol, checker) {
3712
- if (symbol === void 0) {
3713
- return void 0;
3714
- }
3715
- return symbol.flags & ts3.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
3716
- }
3717
- function getAliasedTypeAliasDeclaration(symbol, checker) {
3718
- return getAliasedSymbol(symbol, checker)?.declarations?.find(ts3.isTypeAliasDeclaration);
3719
- }
3720
- function getTypeAliasDeclarationFromTypeReference(typeNode, checker) {
3721
- return getAliasedTypeAliasDeclaration(checker.getSymbolAtLocation(typeNode.typeName), checker);
3722
- }
3723
3722
  function provenanceForNode(node, file) {
3724
3723
  const sourceFile = node.getSourceFile();
3725
3724
  const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
@@ -3743,14 +3742,14 @@ function getNamedTypeName(type) {
3743
3742
  const symbol = type.getSymbol();
3744
3743
  if (symbol?.declarations) {
3745
3744
  const decl = symbol.declarations[0];
3746
- if (decl && (ts3.isClassDeclaration(decl) || ts3.isInterfaceDeclaration(decl) || ts3.isTypeAliasDeclaration(decl))) {
3747
- const name = ts3.isClassDeclaration(decl) ? decl.name?.text : decl.name.text;
3745
+ if (decl && (ts5.isClassDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isTypeAliasDeclaration(decl))) {
3746
+ const name = ts5.isClassDeclaration(decl) ? decl.name?.text : decl.name.text;
3748
3747
  if (name) return name;
3749
3748
  }
3750
3749
  }
3751
3750
  const aliasSymbol = type.aliasSymbol;
3752
3751
  if (aliasSymbol?.declarations) {
3753
- const aliasDecl = aliasSymbol.declarations.find(ts3.isTypeAliasDeclaration);
3752
+ const aliasDecl = aliasSymbol.declarations.find(ts5.isTypeAliasDeclaration);
3754
3753
  if (aliasDecl) {
3755
3754
  return aliasDecl.name.text;
3756
3755
  }
@@ -3761,24 +3760,24 @@ function getNamedTypeDeclaration(type) {
3761
3760
  const symbol = type.getSymbol();
3762
3761
  if (symbol?.declarations) {
3763
3762
  const decl = symbol.declarations[0];
3764
- if (decl && (ts3.isClassDeclaration(decl) || ts3.isInterfaceDeclaration(decl) || ts3.isTypeAliasDeclaration(decl))) {
3763
+ if (decl && (ts5.isClassDeclaration(decl) || ts5.isInterfaceDeclaration(decl) || ts5.isTypeAliasDeclaration(decl))) {
3765
3764
  return decl;
3766
3765
  }
3767
3766
  }
3768
3767
  const aliasSymbol = type.aliasSymbol;
3769
3768
  if (aliasSymbol?.declarations) {
3770
- return aliasSymbol.declarations.find(ts3.isTypeAliasDeclaration);
3769
+ return aliasSymbol.declarations.find(ts5.isTypeAliasDeclaration);
3771
3770
  }
3772
3771
  return void 0;
3773
3772
  }
3774
3773
  function analyzeMethod(method, checker) {
3775
- if (!ts3.isIdentifier(method.name)) {
3774
+ if (!ts5.isIdentifier(method.name)) {
3776
3775
  return null;
3777
3776
  }
3778
3777
  const name = method.name.text;
3779
3778
  const parameters = [];
3780
3779
  for (const param of method.parameters) {
3781
- if (ts3.isIdentifier(param.name)) {
3780
+ if (ts5.isIdentifier(param.name)) {
3782
3781
  const paramInfo = analyzeParameter(param, checker);
3783
3782
  parameters.push(paramInfo);
3784
3783
  }
@@ -3789,7 +3788,7 @@ function analyzeMethod(method, checker) {
3789
3788
  return { name, parameters, returnTypeNode, returnType };
3790
3789
  }
3791
3790
  function analyzeParameter(param, checker) {
3792
- const name = ts3.isIdentifier(param.name) ? param.name.text : "param";
3791
+ const name = ts5.isIdentifier(param.name) ? param.name.text : "param";
3793
3792
  const typeNode = param.type;
3794
3793
  const type = checker.getTypeAtLocation(param);
3795
3794
  const formSpecExportName = detectFormSpecReference(typeNode);
@@ -3798,15 +3797,15 @@ function analyzeParameter(param, checker) {
3798
3797
  }
3799
3798
  function detectFormSpecReference(typeNode) {
3800
3799
  if (!typeNode) return null;
3801
- if (!ts3.isTypeReferenceNode(typeNode)) return null;
3802
- const typeName = ts3.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : ts3.isQualifiedName(typeNode.typeName) ? typeNode.typeName.right.text : null;
3800
+ if (!ts5.isTypeReferenceNode(typeNode)) return null;
3801
+ const typeName = ts5.isIdentifier(typeNode.typeName) ? typeNode.typeName.text : ts5.isQualifiedName(typeNode.typeName) ? typeNode.typeName.right.text : null;
3803
3802
  if (typeName !== "InferSchema" && typeName !== "InferFormSchema") return null;
3804
3803
  const typeArg = typeNode.typeArguments?.[0];
3805
- if (!typeArg || !ts3.isTypeQueryNode(typeArg)) return null;
3806
- if (ts3.isIdentifier(typeArg.exprName)) {
3804
+ if (!typeArg || !ts5.isTypeQueryNode(typeArg)) return null;
3805
+ if (ts5.isIdentifier(typeArg.exprName)) {
3807
3806
  return typeArg.exprName.text;
3808
3807
  }
3809
- if (ts3.isQualifiedName(typeArg.exprName)) {
3808
+ if (ts5.isQualifiedName(typeArg.exprName)) {
3810
3809
  return typeArg.exprName.right.text;
3811
3810
  }
3812
3811
  return null;
@@ -3828,23 +3827,23 @@ function createProgramContextFromProgram(program, filePath) {
3828
3827
  function createProgramContext(filePath, additionalFiles) {
3829
3828
  const absolutePath = path.resolve(filePath);
3830
3829
  const fileDir = path.dirname(absolutePath);
3831
- const configPath = ts4.findConfigFile(fileDir, ts4.sys.fileExists.bind(ts4.sys), "tsconfig.json");
3830
+ const configPath = ts6.findConfigFile(fileDir, ts6.sys.fileExists.bind(ts6.sys), "tsconfig.json");
3832
3831
  let compilerOptions;
3833
3832
  let fileNames;
3834
3833
  if (configPath) {
3835
- const configFile = ts4.readConfigFile(configPath, ts4.sys.readFile.bind(ts4.sys));
3834
+ const configFile = ts6.readConfigFile(configPath, ts6.sys.readFile.bind(ts6.sys));
3836
3835
  if (configFile.error) {
3837
3836
  throw new Error(
3838
- `Error reading tsconfig.json: ${ts4.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`
3837
+ `Error reading tsconfig.json: ${ts6.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`
3839
3838
  );
3840
3839
  }
3841
- const parsed = ts4.parseJsonConfigFileContent(
3840
+ const parsed = ts6.parseJsonConfigFileContent(
3842
3841
  configFile.config,
3843
- ts4.sys,
3842
+ ts6.sys,
3844
3843
  path.dirname(configPath)
3845
3844
  );
3846
3845
  if (parsed.errors.length > 0) {
3847
- const errorMessages = parsed.errors.map((e) => ts4.flattenDiagnosticMessageText(e.messageText, "\n")).join("\n");
3846
+ const errorMessages = parsed.errors.map((e) => ts6.flattenDiagnosticMessageText(e.messageText, "\n")).join("\n");
3848
3847
  throw new Error(`Error parsing tsconfig.json: ${errorMessages}`);
3849
3848
  }
3850
3849
  compilerOptions = parsed.options;
@@ -3852,9 +3851,9 @@ function createProgramContext(filePath, additionalFiles) {
3852
3851
  fileNames = [.../* @__PURE__ */ new Set([...parsed.fileNames, absolutePath, ...normalizedAdditional])];
3853
3852
  } else {
3854
3853
  compilerOptions = {
3855
- target: ts4.ScriptTarget.ES2022,
3856
- module: ts4.ModuleKind.NodeNext,
3857
- moduleResolution: ts4.ModuleResolutionKind.NodeNext,
3854
+ target: ts6.ScriptTarget.ES2022,
3855
+ module: ts6.ModuleKind.NodeNext,
3856
+ moduleResolution: ts6.ModuleResolutionKind.NodeNext,
3858
3857
  strict: true,
3859
3858
  skipLibCheck: true,
3860
3859
  declaration: true
@@ -3862,7 +3861,7 @@ function createProgramContext(filePath, additionalFiles) {
3862
3861
  const normalizedAdditional = (additionalFiles ?? []).map((f) => path.resolve(f));
3863
3862
  fileNames = [.../* @__PURE__ */ new Set([absolutePath, ...normalizedAdditional])];
3864
3863
  }
3865
- const program = ts4.createProgram(fileNames, compilerOptions);
3864
+ const program = ts6.createProgram(fileNames, compilerOptions);
3866
3865
  const sourceFile = program.getSourceFile(absolutePath);
3867
3866
  if (!sourceFile) {
3868
3867
  throw new Error(`Could not find source file: ${absolutePath}`);
@@ -3881,19 +3880,19 @@ function findNodeByName(sourceFile, name, predicate, getName) {
3881
3880
  result = node;
3882
3881
  return;
3883
3882
  }
3884
- ts4.forEachChild(node, visit);
3883
+ ts6.forEachChild(node, visit);
3885
3884
  }
3886
3885
  visit(sourceFile);
3887
3886
  return result;
3888
3887
  }
3889
3888
  function findClassByName(sourceFile, className) {
3890
- return findNodeByName(sourceFile, className, ts4.isClassDeclaration, (n) => n.name?.text);
3889
+ return findNodeByName(sourceFile, className, ts6.isClassDeclaration, (n) => n.name?.text);
3891
3890
  }
3892
3891
  function findInterfaceByName(sourceFile, interfaceName) {
3893
- return findNodeByName(sourceFile, interfaceName, ts4.isInterfaceDeclaration, (n) => n.name.text);
3892
+ return findNodeByName(sourceFile, interfaceName, ts6.isInterfaceDeclaration, (n) => n.name.text);
3894
3893
  }
3895
3894
  function findTypeAliasByName(sourceFile, aliasName) {
3896
- return findNodeByName(sourceFile, aliasName, ts4.isTypeAliasDeclaration, (n) => n.name.text);
3895
+ return findNodeByName(sourceFile, aliasName, ts6.isTypeAliasDeclaration, (n) => n.name.text);
3897
3896
  }
3898
3897
  function getResolvedObjectRootType(rootType, typeRegistry) {
3899
3898
  if (rootType.kind === "object") {
@@ -3933,22 +3932,22 @@ function createResolvedObjectAliasAnalysis(name, rootType, typeRegistry, rootInf
3933
3932
  };
3934
3933
  }
3935
3934
  function containsTypeReferenceInObjectLikeAlias(typeNode) {
3936
- if (ts4.isParenthesizedTypeNode(typeNode)) {
3935
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
3937
3936
  return containsTypeReferenceInObjectLikeAlias(typeNode.type);
3938
3937
  }
3939
- if (ts4.isTypeReferenceNode(typeNode)) {
3938
+ if (ts6.isTypeReferenceNode(typeNode)) {
3940
3939
  return true;
3941
3940
  }
3942
- return ts4.isIntersectionTypeNode(typeNode) && typeNode.types.some((member) => containsTypeReferenceInObjectLikeAlias(member));
3941
+ return ts6.isIntersectionTypeNode(typeNode) && typeNode.types.some((member) => containsTypeReferenceInObjectLikeAlias(member));
3943
3942
  }
3944
3943
  function collectFallbackAliasMemberPropertyNames(typeNode, checker) {
3945
- if (ts4.isParenthesizedTypeNode(typeNode)) {
3944
+ if (ts6.isParenthesizedTypeNode(typeNode)) {
3946
3945
  return collectFallbackAliasMemberPropertyNames(typeNode.type, checker);
3947
3946
  }
3948
- if (ts4.isTypeLiteralNode(typeNode)) {
3947
+ if (ts6.isTypeLiteralNode(typeNode)) {
3949
3948
  const propertyNames = [];
3950
3949
  for (const member of typeNode.members) {
3951
- if (!ts4.isPropertySignature(member)) {
3950
+ if (!ts6.isPropertySignature(member)) {
3952
3951
  continue;
3953
3952
  }
3954
3953
  const propertyName = getAnalyzableObjectLikePropertyName(member.name);
@@ -3958,13 +3957,13 @@ function collectFallbackAliasMemberPropertyNames(typeNode, checker) {
3958
3957
  }
3959
3958
  return propertyNames;
3960
3959
  }
3961
- if (ts4.isTypeReferenceNode(typeNode)) {
3960
+ if (ts6.isTypeReferenceNode(typeNode)) {
3962
3961
  return checker.getTypeFromTypeNode(typeNode).getProperties().map((property) => property.getName());
3963
3962
  }
3964
3963
  return null;
3965
3964
  }
3966
3965
  function findFallbackAliasDuplicatePropertyNames(typeNode, checker) {
3967
- if (!ts4.isIntersectionTypeNode(typeNode)) {
3966
+ if (!ts6.isIntersectionTypeNode(typeNode)) {
3968
3967
  return [];
3969
3968
  }
3970
3969
  const seen = /* @__PURE__ */ new Set();
@@ -4154,7 +4153,7 @@ function makeFileProvenance(filePath) {
4154
4153
  }
4155
4154
 
4156
4155
  // src/generators/class-schema.ts
4157
- import * as ts6 from "typescript";
4156
+ import * as ts8 from "typescript";
4158
4157
 
4159
4158
  // src/metadata/collision-guards.ts
4160
4159
  function assertUniqueSerializedNames(entries, scope) {
@@ -5154,7 +5153,7 @@ function createExtensionRegistry(extensions) {
5154
5153
  }
5155
5154
 
5156
5155
  // src/extensions/symbol-registry.ts
5157
- import * as ts5 from "typescript";
5156
+ import * as ts7 from "typescript";
5158
5157
  import * as path2 from "path";
5159
5158
 
5160
5159
  // src/ui-schema/schema.ts