@typeslayer/validate 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,28 @@
1
+ import Air from "@mui/icons-material/Air";
2
+ import Calculate from "@mui/icons-material/Calculate";
3
+ import Diversity1 from "@mui/icons-material/Diversity1";
4
+ import Expand from "@mui/icons-material/Expand";
5
+ import Lightbulb from "@mui/icons-material/Lightbulb";
6
+ import RotateRight from "@mui/icons-material/RotateRight";
7
+ import SafetyDivider from "@mui/icons-material/SafetyDivider";
8
+ import SubdirectoryArrowRight from "@mui/icons-material/SubdirectoryArrowRight";
1
9
  import { z } from "zod/v4";
10
+ import AltRoute from "@mui/icons-material/AltRoute";
11
+ import Check from "@mui/icons-material/Check";
12
+ import Close from "@mui/icons-material/Close";
13
+ import Extension from "@mui/icons-material/Extension";
14
+ import FilterListAlt from "@mui/icons-material/FilterListAlt";
15
+ import FindReplace from "@mui/icons-material/FindReplace";
16
+ import Input from "@mui/icons-material/Input";
17
+ import JoinFull from "@mui/icons-material/JoinFull";
18
+ import JoinInner from "@mui/icons-material/JoinInner";
19
+ import Key from "@mui/icons-material/Key";
20
+ import Polyline from "@mui/icons-material/Polyline";
21
+ import QuestionMark from "@mui/icons-material/QuestionMark";
22
+ import Search from "@mui/icons-material/Search";
23
+ import SettingsBackupRestore from "@mui/icons-material/SettingsBackupRestore";
24
+ import SportsKabaddi from "@mui/icons-material/SportsKabaddi";
25
+ import TrackChanges from "@mui/icons-material/TrackChanges";
2
26
 
3
27
  //#region src/package-name.ts
4
28
  const packageNameRegex = /\/node_modules\/((?:[^@][^/]+)|(?:@[^/]+\/[^/]+))/g;
@@ -510,6 +534,56 @@ const depthLimits = [
510
534
  event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit,
511
535
  event_checktypes__typeRelatedToDiscriminatedType_DepthLimit
512
536
  ];
537
+ const depthLimitInfo = {
538
+ instantiateType_DepthLimit: {
539
+ title: "Type Instantiation",
540
+ notFound: "No Type Instantiation Limits Found",
541
+ route: "instantiate-type-depth-limit",
542
+ icon: Lightbulb
543
+ },
544
+ recursiveTypeRelatedTo_DepthLimit: {
545
+ title: "Recursive Relations",
546
+ notFound: "No Recursive Relations Limits Found",
547
+ route: "recursive-type-related-to-depth-limit",
548
+ icon: Diversity1
549
+ },
550
+ typeRelatedToDiscriminatedType_DepthLimit: {
551
+ title: "Discrimination",
552
+ notFound: "No Discriminated Type Limits Found",
553
+ route: "type-related-to-discriminated-type-depth-limit",
554
+ icon: SafetyDivider
555
+ },
556
+ checkCrossProductUnion_DepthLimit: {
557
+ title: "Cross-Product Union",
558
+ notFound: "No Cross-Product Union Limits Found",
559
+ route: "check-cross-product-union-depth-limit",
560
+ icon: Calculate
561
+ },
562
+ checkTypeRelatedTo_DepthLimit: {
563
+ title: "Type Relation Depth",
564
+ notFound: "No Type Relation Depth Limits Found",
565
+ route: "check-type-related-to-depth-limit",
566
+ icon: RotateRight
567
+ },
568
+ getTypeAtFlowNode_DepthLimit: {
569
+ title: "Flow Node Type",
570
+ notFound: "No Flow Node Type Limits Found",
571
+ route: "get-type-at-flow-node-depth-limit",
572
+ icon: Air
573
+ },
574
+ removeSubtypes_DepthLimit: {
575
+ title: "Remove Subtypes",
576
+ notFound: "No Remove Subtypes Limits Found",
577
+ route: "remove-subtypes-depth-limit",
578
+ icon: SubdirectoryArrowRight
579
+ },
580
+ traceUnionsOrIntersectionsTooLarge_DepthLimit: {
581
+ title: "Union/Intersection Size",
582
+ notFound: "No Union/Intersection Size Limits Found",
583
+ route: "trace-unions-or-intersections-too-large-depth-limit",
584
+ icon: Expand
585
+ }
586
+ };
513
587
  const event_emit__emit = z.object({
514
588
  ...eventCommon,
515
589
  ...category.emit,
@@ -927,86 +1001,308 @@ const typeRelations = {
927
1001
  reverseMappedMappedType: typeId.optional(),
928
1002
  reverseMappedConstraintType: typeId.optional()
929
1003
  };
1004
+ const typeRelationOrder = [
1005
+ "unionTypes",
1006
+ "intersectionTypes",
1007
+ "typeArguments",
1008
+ "instantiatedType",
1009
+ "aliasTypeArguments",
1010
+ "conditionalCheckType",
1011
+ "conditionalExtendsType",
1012
+ "conditionalFalseType",
1013
+ "conditionalTrueType",
1014
+ "indexedAccessObjectType",
1015
+ "indexedAccessIndexType",
1016
+ "keyofType",
1017
+ "reverseMappedSourceType",
1018
+ "reverseMappedMappedType",
1019
+ "reverseMappedConstraintType",
1020
+ "substitutionBaseType",
1021
+ "constraintType",
1022
+ "evolvingArrayElementType",
1023
+ "evolvingArrayFinalType",
1024
+ "aliasType"
1025
+ ];
930
1026
  const typeRelationInfo = {
931
- typeArguments: {
932
- title: "Type Argument",
933
- unit: "type arguments"
934
- },
935
1027
  unionTypes: {
936
- title: "Union Member",
937
- unit: "unions"
1028
+ source: {
1029
+ title: "Union",
1030
+ unit: "union members",
1031
+ description: "Type whose union has the greatest number of distinct members (breadth of possible shapes)."
1032
+ },
1033
+ target: {
1034
+ title: "Union Member",
1035
+ unit: "unions",
1036
+ description: "The type most frequently included in unions."
1037
+ },
1038
+ route: "union-types",
1039
+ icon: JoinFull
938
1040
  },
939
1041
  intersectionTypes: {
940
- title: "Intersection Member",
941
- unit: "intersections"
1042
+ source: {
1043
+ title: "Intersection",
1044
+ unit: "intersections",
1045
+ description: "Type whose intersection combines the greatest number of constituent types (breadth of constraints)."
1046
+ },
1047
+ target: {
1048
+ title: "Intersection Member",
1049
+ unit: "intersections",
1050
+ description: "The type most frequently included in intersections."
1051
+ },
1052
+ route: "intersection-types",
1053
+ icon: JoinInner
942
1054
  },
943
- aliasTypeArguments: {
944
- title: "Generic Arguments",
945
- unit: "alias type-arguments"
1055
+ typeArguments: {
1056
+ source: {
1057
+ title: "Type Arguments",
1058
+ unit: "type arguments",
1059
+ description: "Generic type with the largest number of supplied type arguments at its most complex instantiation."
1060
+ },
1061
+ target: {
1062
+ title: "Type Argument",
1063
+ unit: "type arguments",
1064
+ description: "The type most frequently used as a type argument (indicating complex generic interactions)."
1065
+ },
1066
+ icon: SportsKabaddi,
1067
+ route: "type-arguments"
946
1068
  },
947
1069
  instantiatedType: {
948
- title: "Instantiated By",
949
- unit: "instantiations"
950
- },
951
- substitutionBaseType: {
952
- title: "Substitution Bases",
953
- unit: "substitution uses"
1070
+ source: {
1071
+ title: "Instantiated",
1072
+ unit: "",
1073
+ description: ""
1074
+ },
1075
+ target: {
1076
+ title: "Instantiated By",
1077
+ unit: "instantiations",
1078
+ description: "Type that was instantiated the most, indicating high reuse."
1079
+ },
1080
+ icon: Polyline,
1081
+ route: "instantiated-type"
954
1082
  },
955
- constraintType: {
956
- title: "Generic Constraints",
957
- unit: "constraint uses"
958
- },
959
- indexedAccessObjectType: {
960
- title: "Object Indexed Access By",
961
- unit: "indexed-accesses"
962
- },
963
- indexedAccessIndexType: {
964
- title: "Tuple Indexed Access By",
965
- unit: "indexed-accesses"
1083
+ aliasTypeArguments: {
1084
+ source: {
1085
+ title: "Generic Argument",
1086
+ unit: "generic arguments",
1087
+ description: "Type alias pulling in the greatest number of distinct generic arguments through its resolution layers."
1088
+ },
1089
+ target: {
1090
+ title: "Generic Arguments",
1091
+ unit: "alias type-arguments",
1092
+ description: "The types most often used as generic arguments. The TypeScript compiler calls this \"alias type-arguments.\" There are technically other kinds of types that can show up here, but it's mostly generic type arguments."
1093
+ },
1094
+ icon: Input,
1095
+ route: "alias-type-arguments"
966
1096
  },
967
1097
  conditionalCheckType: {
968
- title: "Conditional Check Condition",
969
- unit: "conditional checks"
1098
+ source: {
1099
+ title: "Conditional Check",
1100
+ unit: "",
1101
+ description: ""
1102
+ },
1103
+ target: {
1104
+ title: "Conditional Check Condition",
1105
+ unit: "conditional checks",
1106
+ description: "Type most often used as the checked type in conditional types (the `T` in `T extends U ? A : B`)."
1107
+ },
1108
+ icon: QuestionMark,
1109
+ route: "conditional-check-type"
970
1110
  },
971
1111
  conditionalExtendsType: {
972
- title: "Conditional Extends",
973
- unit: "extends uses"
974
- },
975
- conditionalTrueType: {
976
- title: "Conditional True Branch",
977
- unit: "true-branch uses"
1112
+ source: {
1113
+ title: "Conditional Extends",
1114
+ unit: "",
1115
+ description: ""
1116
+ },
1117
+ target: {
1118
+ title: "Conditional Extends",
1119
+ unit: "extends uses",
1120
+ description: "Type most frequently appearing on the `extends` side of conditional types (the `U` in `T extends U ? A : B`)), indicating common constraint relationships."
1121
+ },
1122
+ icon: Extension,
1123
+ route: "conditional-extends-type"
978
1124
  },
979
1125
  conditionalFalseType: {
980
- title: "Conditional False Branch",
981
- unit: "false-branch uses"
1126
+ source: {
1127
+ title: "Conditional False",
1128
+ unit: "",
1129
+ description: ""
1130
+ },
1131
+ target: {
1132
+ title: "Conditional False Branch",
1133
+ unit: "false-branch uses",
1134
+ description: "Type that most often appears as the `false` branch result of conditional types. Indicates fallback/resolution patterns."
1135
+ },
1136
+ icon: Close,
1137
+ route: "conditional-false-type"
982
1138
  },
983
- keyofType: {
984
- title: "Keyof Uses",
985
- unit: "keyof uses"
1139
+ conditionalTrueType: {
1140
+ source: {
1141
+ title: "Conditional True",
1142
+ unit: "",
1143
+ description: ""
1144
+ },
1145
+ target: {
1146
+ title: "Conditional True Branch",
1147
+ unit: "true-branch uses",
1148
+ description: "Type that most often appears as the `true` branch result of conditional types. Indicates favored resolution outcomes."
1149
+ },
1150
+ icon: Check,
1151
+ route: "conditional-true-type"
986
1152
  },
987
- aliasType: {
988
- title: "Aliased As",
989
- unit: "alias uses"
1153
+ indexedAccessObjectType: {
1154
+ source: {
1155
+ title: "Indexed Access Object",
1156
+ unit: "",
1157
+ description: ""
1158
+ },
1159
+ target: {
1160
+ title: "Object Indexed Access By",
1161
+ unit: "indexed-accesses",
1162
+ description: "Type most frequently used as the object operand in indexed access (e.g. `T[K]`), indicating dynamic property shape usage."
1163
+ },
1164
+ icon: Search,
1165
+ route: "indexed-access-object-type"
990
1166
  },
991
- evolvingArrayElementType: {
992
- title: "Evolving Array Element",
993
- unit: "array element uses"
1167
+ indexedAccessIndexType: {
1168
+ source: {
1169
+ title: "Indexed Access Index",
1170
+ unit: "",
1171
+ description: ""
1172
+ },
1173
+ target: {
1174
+ title: "Tuple Indexed Access By",
1175
+ unit: "indexed-accesses",
1176
+ description: "Type most frequently used as the index operand in indexed access of a tuple (e.g. `SomeTuple[K]`)."
1177
+ },
1178
+ icon: Search,
1179
+ route: "indexed-access-index-type"
994
1180
  },
995
- evolvingArrayFinalType: {
996
- title: "Evolving Array Final",
997
- unit: "array final uses"
1181
+ keyofType: {
1182
+ source: {
1183
+ title: "Keyof",
1184
+ unit: "",
1185
+ description: ""
1186
+ },
1187
+ target: {
1188
+ title: "Keyof Uses",
1189
+ unit: "keyof uses",
1190
+ description: "Type most frequently used within 'keyof' operations, often indicating dynamic property access patterns."
1191
+ },
1192
+ icon: Key,
1193
+ route: "keyof-type"
998
1194
  },
999
1195
  reverseMappedSourceType: {
1000
- title: "Reverse-Map Source",
1001
- unit: "reverse-mappings"
1196
+ source: {
1197
+ title: "Reverse Mapped Source",
1198
+ unit: "",
1199
+ description: ""
1200
+ },
1201
+ target: {
1202
+ title: "Reverse-Map Source",
1203
+ unit: "reverse-mappings",
1204
+ description: "Type most commonly appearing as the source in reverse-mapped type transforms (utility mapped types in reverse)."
1205
+ },
1206
+ icon: SettingsBackupRestore,
1207
+ route: "reverse-mapped-source-type"
1002
1208
  },
1003
1209
  reverseMappedMappedType: {
1004
- title: "Reverse-Map Mapped By",
1005
- unit: "reverse-mapped sources"
1210
+ source: {
1211
+ title: "Reverse Mapped Mapped",
1212
+ unit: "",
1213
+ description: ""
1214
+ },
1215
+ target: {
1216
+ title: "Reverse-Map Mapped By",
1217
+ unit: "reverse-mapped sources",
1218
+ description: "Type most commonly produced by reverse-mapped transformations."
1219
+ },
1220
+ icon: SettingsBackupRestore,
1221
+ route: "reverse-mapped-mapped-type"
1006
1222
  },
1007
1223
  reverseMappedConstraintType: {
1008
- title: "Reverse-Map Constraints",
1009
- unit: "reverse-mapping constraints"
1224
+ source: {
1225
+ title: "Reverse Mapped Constraint",
1226
+ unit: "",
1227
+ description: ""
1228
+ },
1229
+ target: {
1230
+ title: "Reverse-Map Constraints",
1231
+ unit: "reverse-mapping constraints",
1232
+ description: "Type that often serves as a constraint in reverse-mapped transformations, indicating mapped type bounds."
1233
+ },
1234
+ icon: SettingsBackupRestore,
1235
+ route: "reverse-mapped-constraint-type"
1236
+ },
1237
+ substitutionBaseType: {
1238
+ source: {
1239
+ title: "Substitution Base",
1240
+ unit: "",
1241
+ description: ""
1242
+ },
1243
+ target: {
1244
+ title: "Substitution Bases",
1245
+ unit: "substitution uses",
1246
+ description: "Type used as a substitution base during type substitution operations, signaling types that commonly serve as generic inference placeholders."
1247
+ },
1248
+ icon: FindReplace,
1249
+ route: "substitution-base-type"
1250
+ },
1251
+ constraintType: {
1252
+ source: {
1253
+ title: "Constraint",
1254
+ unit: "",
1255
+ description: ""
1256
+ },
1257
+ target: {
1258
+ title: "Generic Constraints",
1259
+ unit: "constraint uses",
1260
+ description: "Type most often appearing as a generic constraint (e.g. in `extends` clauses) when resolving generics and conditionals."
1261
+ },
1262
+ icon: FilterListAlt,
1263
+ route: "constraint-type"
1264
+ },
1265
+ evolvingArrayElementType: {
1266
+ source: {
1267
+ title: "Evolving Array Element",
1268
+ unit: "",
1269
+ description: ""
1270
+ },
1271
+ target: {
1272
+ title: "Evolving Array Element",
1273
+ unit: "array element uses",
1274
+ description: "Type most commonly used as the evolving array element during array widening/folding operations in inference."
1275
+ },
1276
+ icon: TrackChanges,
1277
+ route: "evolving-array-element-type"
1278
+ },
1279
+ evolvingArrayFinalType: {
1280
+ source: {
1281
+ title: "Evolving Array Final",
1282
+ unit: "",
1283
+ description: ""
1284
+ },
1285
+ target: {
1286
+ title: "Evolving Array Final",
1287
+ unit: "array final uses",
1288
+ description: "Type that frequently becomes the final element type after array evolution/widening, useful to spot common widened shapes."
1289
+ },
1290
+ icon: TrackChanges,
1291
+ route: "evolving-array-final-type"
1292
+ },
1293
+ aliasType: {
1294
+ source: {
1295
+ title: "Alias",
1296
+ unit: "",
1297
+ description: ""
1298
+ },
1299
+ target: {
1300
+ title: "Aliased As",
1301
+ unit: "alias uses",
1302
+ description: "Type most frequently used as an alias target, shows which aliases are heavily reused across the codebase."
1303
+ },
1304
+ icon: AltRoute,
1305
+ route: "alias-type"
1010
1306
  }
1011
1307
  };
1012
1308
  const resolvedType = z.object({
@@ -1043,5 +1339,5 @@ const resolvedType = z.object({
1043
1339
  const typesJsonSchema = z.array(resolvedType);
1044
1340
 
1045
1341
  //#endregion
1046
- export { CPU_PROFILE_FILENAME, TRACE_JSON_FILENAME, TYPES_JSON_FILENAME, createTypeRegistry, depthLimits, eventPhase, event_checktypes__checkCrossProductUnion_DepthLimit, event_checktypes__checkTypeRelatedTo_DepthLimit, event_checktypes__getTypeAtFlowNode_DepthLimit, event_checktypes__instantiateType_DepthLimit, event_checktypes__recursiveTypeRelatedTo_DepthLimit, event_checktypes__removeSubtypes_DepthLimit, event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit, event_checktypes__typeRelatedToDiscriminatedType_DepthLimit, extractPackageName, packageNameRegex, relativizePath, resolvedType, traceEvent, traceJsonSchema, typeRelationInfo, typesJsonSchema };
1342
+ export { CPU_PROFILE_FILENAME, TRACE_JSON_FILENAME, TYPES_JSON_FILENAME, createTypeRegistry, depthLimitInfo, depthLimits, eventPhase, event_checktypes__checkCrossProductUnion_DepthLimit, event_checktypes__checkTypeRelatedTo_DepthLimit, event_checktypes__getTypeAtFlowNode_DepthLimit, event_checktypes__instantiateType_DepthLimit, event_checktypes__recursiveTypeRelatedTo_DepthLimit, event_checktypes__removeSubtypes_DepthLimit, event_checktypes__traceUnionsOrIntersectionsTooLarge_DepthLimit, event_checktypes__typeRelatedToDiscriminatedType_DepthLimit, extractPackageName, packageNameRegex, relativizePath, resolvedType, traceEvent, traceJsonSchema, typeRelationInfo, typeRelationOrder, typesJsonSchema };
1047
1343
  //# sourceMappingURL=index.mjs.map