@ts-runtypes/devtools 0.9.3 → 0.11.0
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/README.md +25 -66
- package/dist/diagnosticCatalog.d.ts +2 -2
- package/dist/diagnosticCatalog.d.ts.map +1 -1
- package/dist/diagnosticCatalog.js +2 -2
- package/dist/diagnosticCatalog.js.map +1 -1
- package/dist/eslint/diagnosticRouting.d.ts +8 -1
- package/dist/eslint/diagnosticRouting.d.ts.map +1 -1
- package/dist/eslint/diagnosticRouting.js +219 -35
- package/dist/eslint/diagnosticRouting.js.map +1 -1
- package/dist/eslint/index.d.ts +2 -0
- package/dist/eslint/index.d.ts.map +1 -1
- package/dist/eslint/index.js +22 -26
- package/dist/eslint/index.js.map +1 -1
- package/dist/eslint/lint-worker.js +31 -20
- package/dist/eslint/lint-worker.js.map +1 -1
- package/dist/eslint/prefilter.d.ts.map +1 -1
- package/dist/eslint/prefilter.js +2 -2
- package/dist/eslint/prefilter.js.map +1 -1
- package/dist/eslint/session-protocol.d.ts +5 -4
- package/dist/eslint/session-protocol.d.ts.map +1 -1
- package/dist/eslint/session-protocol.js +2 -0
- package/dist/eslint/session-protocol.js.map +1 -1
- package/dist/eslint/session.d.ts.map +1 -1
- package/dist/eslint/session.js +7 -1
- package/dist/eslint/session.js.map +1 -1
- package/dist/{diagnosticCatalog.generated.d.ts → go-generated/diagnosticCatalog.generated.d.ts} +1 -0
- package/dist/go-generated/diagnosticCatalog.generated.d.ts.map +1 -0
- package/dist/{diagnosticCatalog.generated.js → go-generated/diagnosticCatalog.generated.js} +269 -66
- package/dist/go-generated/diagnosticCatalog.generated.js.map +1 -0
- package/dist/go-generated/reflectionKind.generated.d.ts +59 -0
- package/dist/go-generated/reflectionKind.generated.d.ts.map +1 -0
- package/dist/go-generated/reflectionKind.generated.js +59 -0
- package/dist/go-generated/reflectionKind.generated.js.map +1 -0
- package/dist/{runtypes-constants.generated.d.ts → go-generated/runtypes-constants.generated.d.ts} +9 -27
- package/dist/go-generated/runtypes-constants.generated.d.ts.map +1 -0
- package/dist/{runtypes-constants.generated.js → go-generated/runtypes-constants.generated.js} +5 -18
- package/dist/go-generated/runtypes-constants.generated.js.map +1 -0
- package/dist/go-generated/tsconfig-plugin-keys.generated.d.ts +3 -0
- package/dist/go-generated/tsconfig-plugin-keys.generated.d.ts.map +1 -0
- package/dist/go-generated/tsconfig-plugin-keys.generated.js +18 -0
- package/dist/go-generated/tsconfig-plugin-keys.generated.js.map +1 -0
- package/dist/packages/ts-runtypes-devtools/tsconfig.test.tsbuildinfo +1 -1
- package/dist/plugin-option-keys.d.ts +3 -0
- package/dist/plugin-option-keys.d.ts.map +1 -0
- package/dist/plugin-option-keys.js +24 -0
- package/dist/plugin-option-keys.js.map +1 -0
- package/dist/protocol.d.ts +28 -43
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +3 -41
- package/dist/protocol.js.map +1 -1
- package/dist/resolver-client.d.ts +41 -12
- package/dist/resolver-client.d.ts.map +1 -1
- package/dist/resolver-client.js +147 -50
- package/dist/resolver-client.js.map +1 -1
- package/dist/unplugin.d.ts +30 -8
- package/dist/unplugin.d.ts.map +1 -1
- package/dist/unplugin.js +155 -37
- package/dist/unplugin.js.map +1 -1
- package/oxlint-recommended.json +32 -0
- package/package.json +4 -3
- package/dist/diagnosticCatalog.generated.d.ts.map +0 -1
- package/dist/diagnosticCatalog.generated.js.map +0 -1
- package/dist/runtypes-constants.generated.d.ts.map +0 -1
- package/dist/runtypes-constants.generated.js.map +0 -1
|
@@ -1,572 +1,775 @@
|
|
|
1
1
|
export const DIAGNOSTIC_CATALOG = {
|
|
2
|
+
CES001: {
|
|
3
|
+
headline: '`cloneExactShape` does not support unions with object members — the emitter cannot know which declared shape to rebuild at runtime.',
|
|
4
|
+
severity: 'error',
|
|
5
|
+
detail: 'A clone built from the declared shape needs to know WHICH union arm the\nruntime value matches; v1 has no arm discrimination, and silently keeping\nunknown keys would defeat the strip guarantee, so the build fails instead.\n\nWorkarounds: narrow the value to one arm before cloning (one\n`createCloneExactShapeFn<Arm>()` per arm), or restructure the union into a\nsingle object with optional properties.',
|
|
6
|
+
},
|
|
7
|
+
CES003: {
|
|
8
|
+
headline: '`cloneExactShape` cannot clone a function-typed value.',
|
|
9
|
+
severity: 'error',
|
|
10
|
+
detail: "Functions aren't data — there is no declared shape to rebuild. Function-typed\nPROPERTIES are dropped from the clone (CES010/CES011); a function at the root\nor a propagating position fails the build.",
|
|
11
|
+
},
|
|
12
|
+
CES010: {
|
|
13
|
+
headline: 'Property `{0}` is a function — `cloneExactShape` cannot rebuild it, so it is kept on the clone, SHARED BY REFERENCE.',
|
|
14
|
+
severity: 'warning',
|
|
15
|
+
detail: "Declared members are never dropped (only UNDECLARED keys are — that is the\nstrip guarantee). Functions cannot be rebuilt from a declared shape, so the\nclone's property points at the SAME function as the input's. Class METHODS\ndiffer: they ride the shared prototype and are not copied as own props\n(CES011).",
|
|
16
|
+
},
|
|
17
|
+
CES011: {
|
|
18
|
+
headline: "Method `{0}` is not copied onto the clone's own properties — methods ride the prototype.",
|
|
19
|
+
severity: 'warning',
|
|
20
|
+
detail: 'For a plain class instance the clone preserves the PROTOTYPE\n(`Object.create(Object.getPrototypeOf(v))`), so methods keep working via the\nprototype chain; they are simply not copied as own properties. For object\nliterals a method-typed member is omitted like any function value.',
|
|
21
|
+
},
|
|
22
|
+
CES012: {
|
|
23
|
+
headline: 'Static member `{0}` is not part of instance data — `cloneExactShape` skips it.',
|
|
24
|
+
severity: 'warning',
|
|
25
|
+
detail: 'Statics live on the class, not the instance; the clone rebuilds instance\ndata only.',
|
|
26
|
+
},
|
|
27
|
+
CES015: {
|
|
28
|
+
headline: 'Property `{0}` has a value type `cloneExactShape` cannot rebuild (symbol, Promise, or a non-serialisable built-in) — it is kept on the clone, SHARED BY REFERENCE.',
|
|
29
|
+
severity: 'warning',
|
|
30
|
+
detail: "Declared members are never dropped (only UNDECLARED keys are — that is the\nstrip guarantee). A value the emitter cannot rebuild passes through by\nreference instead: the clone's property points at the SAME handle as the\ninput's, so mutations through it are visible on both sides. Register\n`overrideCloneExactShape<T>()` if this type needs custom copying.",
|
|
31
|
+
},
|
|
32
|
+
CFG001: {
|
|
33
|
+
headline: 'Project tsconfig failed to load ({0}) — the build, the linter, and the CLI all read this config, so nothing can run until it loads.',
|
|
34
|
+
severity: 'error',
|
|
35
|
+
detail: 'RunTypes derives every type query from your project tsconfig, the same\nfile your build uses. A tsconfig that was named (or found next to your\nproject) but is missing or does not parse stops the operation, exactly\nlike `tsc --project` would, instead of silently falling back to defaults\nthat could resolve your types differently.\n\nFix — repair the tsconfig (the message names the first parse problem),\nor point the tooling at the right file (the plugin/lint `tsconfig`\nsetting, or the CLI `--tsconfig` flag).',
|
|
36
|
+
},
|
|
2
37
|
CLS001: {
|
|
3
38
|
headline: 'class `{0}` is serialized structurally; register it via `registerClassSerializer({0}, { deserialize })` to round-trip a real instance.',
|
|
39
|
+
severity: 'warning',
|
|
4
40
|
detail: "By default a user class is serialized by its declared properties and\ndecoded back to a prototype-less plain object — `instanceof {0}` is\nfalse on the decoded value, and any class methods / getters are gone.\nThis is fine when you only care about the data.\n\nTo round-trip a real `{0}` instance, register it once, passing the class\nitself (not a name string):\n import {registerClassSerializer} from '@ts-runtypes/core';\n\n // zero-arg constructor: nothing else needed\n registerClassSerializer({0});\n\n // non-empty constructor: only `deserialize` is required\n registerClassSerializer({0}, {\n deserialize: (data) => new {0}(/* rebuild from data */),\n });\n\n`serialize` is optional (default: structural, same as any interface);\n`deserialize` is optional for a zero-arg class (default:\n`Object.assign(new {0}(), data)`). The same registration is used by the\nJSON and binary families. `validate` / `getValidationErrors` are\nunaffected — they always validate structurally.",
|
|
5
41
|
},
|
|
6
42
|
CTA001: {
|
|
7
43
|
headline: '`CompTimeArgs<T>` argument must be a literal at the call site, or a `const` whose initializer is itself entirely literal (a same-module or imported `const` both work).',
|
|
8
|
-
|
|
44
|
+
severity: 'error',
|
|
45
|
+
detail: "The build resolves the argument before running, so it needs to read its\nvalue from the source. Function-call results, property accesses, ternary\nexpressions, and `let`/`var` bindings can't be evaluated at build time.\nAccepted: an inline literal, or a `const` whose initializer is itself\nfully literal — including a `const` imported from another module. (An\nobject `const` must be `as const` so its members stay literal; see CTA004.)\n\nFix — inline at the call site:\n- const opts = getOpts();\n- const isUser = createValidateFn<User>(undefined, opts);\n+ const isUser = createValidateFn<User>(undefined, {mode: 'unsafe'});\n\nFix — use a const of literals (here or in another module):\n const opts = {mode: 'unsafe'} as const; // literal initializer ✓\n const isUser = createValidateFn<User>(undefined, opts);",
|
|
9
46
|
},
|
|
10
47
|
CTA002: {
|
|
11
48
|
headline: '`CompTimeArgs<T>` literal nesting exceeds the depth cap (16) — refactor to flatten.',
|
|
49
|
+
severity: 'error',
|
|
12
50
|
detail: 'Deeply nested literal walks are capped at 16 levels to keep the build\npredictable. If you hit this, the value is almost certainly not what\nyou want at compile time — split it across multiple smaller\n`CompTimeArgs<T>` arguments, or flatten the nesting.',
|
|
13
51
|
},
|
|
14
52
|
CTA003: {
|
|
15
53
|
headline: '`CompTimeArgs<T>` literal contains a forbidden construct ({0}). Only literals and nested literals are allowed.',
|
|
54
|
+
severity: 'error',
|
|
16
55
|
detail: "The Go scanner cannot statically evaluate computed property names,\nfunction calls, ternary expressions, or template-string substitutions.\nInside a `CompTimeArgs<T>` literal every node must be a direct literal\n(string / number / bigint / boolean / null / undefined / regex / arrow /\nobject literal / array literal) or a const-traced identifier that\nresolves to one.\n\nSpread IS allowed when its operand resolves to a literal container of the\nmatching kind — a `const`-bound (or imported) object literal for an\nobject spread, an array literal for an array spread:\n const base = {strict: true};\n const a = {...base, mode: 'unsafe'}; // ok — merges a const fragment\n\nA spread is still rejected when the operand can't be statically merged —\na dynamic value, or a shape mismatch:\n - const a = {...getDefaults(), mode: 'unsafe'}; // dynamic operand\n - const a = {...[1, 2], mode: 'unsafe'}; // object spread of an array",
|
|
17
56
|
},
|
|
18
57
|
CTA004: {
|
|
19
58
|
headline: '`CompTimeArgs<T>` value comes from a `const` with a widened (non-literal) member ({0}) — declare the const `as const`.',
|
|
20
|
-
|
|
59
|
+
severity: 'error',
|
|
60
|
+
detail: "A `const` used as a CompTimeArgs / CompTimeFnArgs argument (a whole option\nbag, or a builder child) must carry LITERAL value types, so the value the\nbuild reads matches the type TypeScript resolves the call against. Without\n`as const`, an object literal's members widen — `{strategy: 'mutate'}`\nbecomes `{strategy: string}` — which can let the type system select one\nfunction variant while the build injects another.\n\nWhole imported consts now resolve cross-module (like a spread fragment), so\nthis rule keeps that path sound.\n\nFix — add `as const`:\n- const preset = {strategy: 'mutate'};\n+ const preset = {strategy: 'mutate'} as const;\n createJsonEncoderFn(undefined, preset);",
|
|
21
61
|
},
|
|
22
62
|
FB001: {
|
|
23
|
-
headline: '
|
|
63
|
+
headline: 'Type `{0}` can never be deserialised from binary — the generated function will always fail.',
|
|
64
|
+
severity: 'error',
|
|
24
65
|
detail: "`never` is the empty type — no value can ever inhabit it. A field\ntyped `never` cannot carry a runtime value, so there is nothing to\nencode/decode/validate.\n\nFix — use `unknown` if you really want to accept any value:\n interface User {\n- tag: never;\n+ tag: unknown; // narrow before use\n }\n\nFix — pick a concrete type matching your real data:\n interface User {\n- tag: never;\n+ tag: 'pending' | 'active' | 'done';\n }",
|
|
25
66
|
},
|
|
26
67
|
FB002: {
|
|
27
|
-
headline: '
|
|
68
|
+
headline: 'Type `{0}` can never be deserialised from binary — the generated function will always fail.',
|
|
69
|
+
severity: 'error',
|
|
28
70
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
29
71
|
},
|
|
30
72
|
FB003: {
|
|
31
|
-
headline: '
|
|
73
|
+
headline: 'Type `{0}` can never be deserialised from binary — the generated function will always fail.',
|
|
74
|
+
severity: 'error',
|
|
32
75
|
detail: "Functions have no value form to serialise — their closure, prototype,\nand bound state aren't representable in JSON or binary.\n\nFix — drop the function from your type, or replace it with the data the\nfunction would produce:\n interface User {\n- getName: () => string;\n+ name: string;\n }",
|
|
33
76
|
},
|
|
34
77
|
FB004: {
|
|
35
|
-
headline: '
|
|
78
|
+
headline: 'Type `{0}` can never be deserialised from binary — the generated function will always fail.',
|
|
79
|
+
severity: 'error',
|
|
36
80
|
detail: "Arrays of un-serialisable elements (`symbol[]`, `(() => void)[]`,\n`Map<K, V>[]`, etc.) can't be encoded — every element would need to be\nrepresentable, and these aren't. Dropping individual elements would\nchange the array length, so the encoder refuses rather than silently\nshipping a different shape.\n\nFix — change the element type to something serialisable:\n - type Items = (() => void)[];\n+ type Items = string[];",
|
|
37
81
|
},
|
|
38
82
|
FB005: {
|
|
39
|
-
headline: '
|
|
83
|
+
headline: 'Type `{0}` can never be deserialised from binary — the generated function will always fail.',
|
|
84
|
+
severity: 'error',
|
|
40
85
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
41
86
|
},
|
|
42
87
|
FB006: {
|
|
43
|
-
headline: '
|
|
88
|
+
headline: 'Type `{0}` can never be deserialised from binary — the generated function will always fail.',
|
|
89
|
+
severity: 'error',
|
|
44
90
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
45
91
|
},
|
|
46
92
|
FB010: {
|
|
47
93
|
headline: 'Property `{0}` is a function — `fromBinary` does not handle function values, so this property is silently not deserialised.',
|
|
94
|
+
severity: 'warning',
|
|
48
95
|
detail: '`fromBinary` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
49
96
|
},
|
|
50
97
|
FB011: {
|
|
51
98
|
headline: "Method `{0}` is silently not deserialised by `fromBinary` — methods aren't data.",
|
|
99
|
+
severity: 'warning',
|
|
52
100
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`fromBinary` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
53
101
|
},
|
|
54
102
|
FB012: {
|
|
55
103
|
headline: "Static member `{0}` is silently not deserialised by `fromBinary` — statics aren't part of instance data.",
|
|
104
|
+
severity: 'warning',
|
|
56
105
|
detail: 'Class static members live on the class, not on individual instances.\n`fromBinary` operates on instance shape, so statics are excluded.',
|
|
57
106
|
},
|
|
58
107
|
FB013: {
|
|
59
108
|
headline: "Symbol-keyed property `{0}` is silently not deserialised by `fromBinary` — symbol keys aren't JSON-representable.",
|
|
109
|
+
severity: 'warning',
|
|
60
110
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `fromBinary` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
61
111
|
},
|
|
62
112
|
FB014: {
|
|
63
113
|
headline: "Union member(s) of type `{0}` can't be represented as data — `fromBinary` drops them, so the union is deserialised as its remaining members.",
|
|
114
|
+
severity: 'warning',
|
|
64
115
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `fromBinary` deserialised only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `fromBinary` throws at build time instead.',
|
|
65
116
|
},
|
|
66
117
|
FB015: {
|
|
67
118
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `fromBinary` drops it, so this property is silently not deserialised.',
|
|
119
|
+
severity: 'warning',
|
|
68
120
|
detail: '`fromBinary` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `fromBinary` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
69
121
|
},
|
|
70
122
|
FMT001: {
|
|
71
123
|
headline: 'TypeFormat mockSample "{0}" does not match its pattern /{1}/ — fix the sample or the pattern.',
|
|
124
|
+
severity: 'error',
|
|
72
125
|
},
|
|
73
126
|
FMT002: {
|
|
74
127
|
headline: 'Invalid type-format params — {0}',
|
|
128
|
+
severity: 'error',
|
|
75
129
|
},
|
|
76
130
|
FMT003: {
|
|
77
131
|
headline: 'TypeFormat mockSample violates a sibling constraint — {0}',
|
|
78
|
-
|
|
132
|
+
severity: 'error',
|
|
133
|
+
detail: "A mockSample is meant to be a canonical VALID value for the format, so it\nmust satisfy the format's own statically checkable siblings (length /\nminLength / maxLength, and the plain-string allowedChars / disallowedChars /\ndisallowedValues ops). A sample that its siblings reject means\n`createMockDataFn` would either produce an invalid value or filter every\nsample out and throw at mock time.\n\nLengths are counted in UTF-16 code units, exactly as the emitted validator's\n`.length` check counts them.\n\nFix — adjust the offending sample(s), or relax the constraint:\n - String<{minLength: 5; pattern: {source: '^b+$'; mockSamples: ['b', 'bb']}}>\n+ String<{minLength: 1; pattern: {source: '^b+$'; mockSamples: ['b', 'bb']}}>",
|
|
79
134
|
},
|
|
80
135
|
FMT004: {
|
|
81
136
|
headline: "TypeFormat pattern /{0}/ carries mockSamples but uses JS-only regex features RE2 can't compile ({1}) — samples can't be verified at build time.",
|
|
137
|
+
severity: 'error',
|
|
82
138
|
detail: "The build-time sample check compiles the pattern with Go's RE2 engine, which\ndoesn't support JS-only features (lookarounds, backreferences). The build\nfails closed rather than ship samples it can't verify.\n\nFix — set `allowUncheckedPatterns` (plugin option / tsconfig plugin key)\nto assert that the JS linter owns the check, then wire the ts-runtypes lint\nplugin into your editor + CI: it evaluates the real `RegExp.test(sample)` and\nreports any mismatch (as FMT001) at the definition site.\n\nFix — or rewrite the pattern using RE2-compatible syntax so the fast\nbuild-time check can run (no lookarounds / backreferences).",
|
|
83
139
|
},
|
|
84
140
|
FT002: {
|
|
85
141
|
headline: 'Unknown field `{0}` — the type does not declare it, so this FriendlyText entry is dead.',
|
|
86
|
-
|
|
142
|
+
severity: 'error',
|
|
143
|
+
detail: "The FriendlyText map names a field the source type does not have\n(removed, renamed, or a typo). Its labels and messages can never be\nused.\n\nExample — `nick` no longer exists on the type:\n interface User { name: string }\n export const friendlyUser: FriendlyText<User> = {\n name: {rt$label: 'Name'},\n- nick: {rt$label: 'Nickname'},\n };\n\nFix — remove the entry, or re-run the reconcile so the mirror follows\nthe type (a renamed field carries its authored values along):\n ts-runtypes enrich <source.ts> <Type> --update",
|
|
87
144
|
},
|
|
88
145
|
FT003: {
|
|
89
146
|
headline: 'Error key `{0}` is not a declared constraint of this field — the message can never fire.',
|
|
147
|
+
severity: 'warning',
|
|
90
148
|
detail: "`rt$errors` keys must name a failure the field can actually produce:\n`type`, `rt$default`, or one of the field's declared format constraints\n(`minLength`, `pattern`, `min`, …). An undeclared key is dead\nconfiguration.\n\nExample — the field has no `maxLength` constraint:\n interface User { name: string & FormatString<{minLength: 2}> }\n export const friendlyUser: FriendlyText<User> = {\n name: {\n rt$errors: {\n minLength: 'Name needs at least 2 characters',\n- maxLength: 'Name is too long',\n },\n },\n };\n\nFix — remove the key, or declare the matching constraint on the field's\nTypeFormat so the message has a failure to describe.",
|
|
91
149
|
},
|
|
92
150
|
FT005: {
|
|
93
151
|
headline: 'Unknown placeholder `$[{0}]` — expected one of `$[label]`, `$[val]`, `$[path]`, `$[index]`.',
|
|
152
|
+
severity: 'warning',
|
|
94
153
|
detail: "Error-message templates substitute a fixed placeholder set; an unknown\nname renders literally instead of substituting.\n\nExample:\n- rt$errors: {minLength: '$[name] is too short'}\n+ rt$errors: {minLength: '$[label] is too short'}\n\nFix — use one of the recognised placeholders, or write the literal text\nwithout the `$[…]` wrapper.",
|
|
95
154
|
},
|
|
96
155
|
FT006: {
|
|
97
156
|
headline: 'Plural error template is missing the mandatory `other` arm — the render has no backstop.',
|
|
157
|
+
severity: 'error',
|
|
98
158
|
detail: "Plural templates render the CLDR arm matching the count, and `other` is\nthe arm every locale falls back to. Without it some counts have no\nmessage at all.\n\nExample:\n rt$errors: {\n minLength: {\n one: 'Needs one more character',\n+ other: 'Needs $[val] more characters',\n },\n }\n\nFix — add the `other` arm to the plural object.",
|
|
99
159
|
},
|
|
100
160
|
FT007: {
|
|
101
161
|
headline: 'Unknown plural arm `{0}` — CLDR categories are `zero`, `one`, `two`, `few`, `many`, `other`.',
|
|
162
|
+
severity: 'warning',
|
|
102
163
|
detail: "Plural template keys must be CLDR plural categories; anything else can\nnever be selected by any locale's plural rules.\n\nExample:\n rt$errors: {\n minLength: {\n- single: 'Needs one more character',\n+ one: 'Needs one more character',\n other: 'Needs $[val] more characters',\n },\n }\n\nFix — rename the arm to one of the six categories, or remove it.",
|
|
103
164
|
},
|
|
104
165
|
FT008: {
|
|
105
166
|
headline: 'Constraint `{0}` carries no count — a plural template here has dead arms; use a plain string.',
|
|
167
|
+
severity: 'warning',
|
|
106
168
|
detail: "Only count-bearing constraints (`minLength`, `maxLength`, `min`, `max`,\n…) can select a plural arm. On a non-count constraint only `other` ever\nrenders, so the remaining arms are dead configuration.\n\nExample — `pattern` has no count:\n rt$errors: {\n- pattern: {one: 'One bad character', other: 'Invalid characters'},\n+ pattern: 'Only letters and numbers are allowed',\n }\n\nFix — replace the plural object with a plain string message.",
|
|
107
169
|
},
|
|
108
170
|
FT009: {
|
|
109
171
|
headline: '`rt$default` is mutually exclusive with per-constraint messages — use one mode or the other.',
|
|
172
|
+
severity: 'error',
|
|
110
173
|
detail: "An `rt$errors` record is either ONE `rt$default` catch-all or a set of\nper-constraint keys, mirroring the TypeScript union. Mixing them makes\nthe intent ambiguous (which message wins?).\n\nExample:\n rt$errors: {\n- rt$default: 'Invalid name',\n minLength: 'Name is too short',\n }\n\nFix — keep `{rt$default: '…'}` alone, or keep the per-constraint keys\nand drop `rt$default`.",
|
|
111
174
|
},
|
|
112
175
|
FT011: {
|
|
113
176
|
headline: 'Property `{0}` collides with the reserved `rt$` enrichment prefix — the type cannot be enriched.',
|
|
177
|
+
severity: 'error',
|
|
114
178
|
detail: '`rt$`-prefixed keys are reserved for enrichment meta (`rt$label`,\n`rt$errors`, `rt$items`, …); a source property with that prefix is\nindistinguishable from node meta, so gen refuses the type and the\nFriendlyType checker reports it here.\n\nFix — rename the property (a plain `$` prefix is fine; only `rt$` is\nreserved):\n interface Config {\n- rt$mode: string;\n+ $mode: string;\n }',
|
|
115
179
|
},
|
|
116
180
|
FT020: {
|
|
117
181
|
headline: 'Unfilled `@todo` placeholder — fill in the real labels/messages, then delete the `@todo` line.',
|
|
182
|
+
severity: 'error',
|
|
118
183
|
detail: "The generator stamps a `@todo` line on every freshly-scaffolded const in\na FriendlyText mirror file. It means \"this skeleton still carries\ngenerated blanks\". A clean, committed mirror has none.\n\nExample — a fresh scaffold:\n /** @rtType User#a1b2c3 @rtIds {name: d4e5f6} */\n- // @todo: generated skeleton — fill in real data, then delete this line\n export const friendlyUser: FriendlyText<User> = {\n- name: {rt$label: ''},\n+ name: {rt$label: 'Name'},\n };\n\nFix — author the real labels and error messages for the const, then\ndelete the whole `@todo` line (the compiler never removes it for you).",
|
|
119
184
|
},
|
|
120
185
|
FT021: {
|
|
121
|
-
headline: 'Stale `@rtOrphan` carcass — run `ts-runtypes
|
|
122
|
-
|
|
186
|
+
headline: 'Stale `@rtOrphan` carcass — run `ts-runtypes enrich --prune` to remove it (or restore the type).',
|
|
187
|
+
severity: 'error',
|
|
188
|
+
detail: 'The reconcile commented this FriendlyText const out because its source\ntype was deleted or renamed. The carcass preserves your authored labels\nand messages so a reappearing type can restore them — but a clean,\ncommitted mirror has none.\n\nFix — if the type is really gone, prune the carcass:\n ts-runtypes enrich --prune\n\nFix — if the type was renamed, re-run the reconcile; a matching carcass\nis restored with your values intact:\n ts-runtypes enrich <source.ts> <NewName> --update',
|
|
123
189
|
},
|
|
124
190
|
FT022: {
|
|
125
|
-
headline: 'Stale `@rtOrphanChild` field carcass — run `ts-runtypes
|
|
126
|
-
|
|
191
|
+
headline: 'Stale `@rtOrphanChild` field carcass — run `ts-runtypes enrich --prune` to remove it (or restore the field).',
|
|
192
|
+
severity: 'error',
|
|
193
|
+
detail: "The reconcile commented this field out because the source type no longer\ndeclares it. The carcass preserves your authored value inline — but a\nclean, committed mirror has none.\n\nExample:\n export const friendlyUser: FriendlyText<User> = {\n- /* @rtOrphanChild nick: {rt$label: 'Nickname'}, */\n name: {rt$label: 'Name'},\n };\n\nFix — if the field is really gone: `ts-runtypes enrich --prune`.\nFix — if the field was renamed, re-run `--update`; the authored value\nmoves to the renamed field when the ids match.",
|
|
194
|
+
},
|
|
195
|
+
FT023: {
|
|
196
|
+
headline: 'Unfilled blank value — a scaffolded label or message is still empty; fill in the real text.',
|
|
197
|
+
severity: 'error',
|
|
198
|
+
detail: "An empty string (`''`) at a `rt$label` / `rt$errors` slot is a generated\nblank that never got authored — it ships blank to the UI wherever the\nfriendly text is shown, so it is exactly as incomplete as a `@todo`\nmarker. This is why removing the `@todo` line without filling the values\nis not \"done\".\n\nExample:\n export const friendlyUser: FriendlyText<User> = {\n- name: {rt$label: ''},\n+ name: {rt$label: 'Name'},\n };\n\nFix — author the real label / message. Only the completeness gate\n(`ts-runtypes enrich --require-complete`) fails on it; a plain\n`--no-emit` health check reports it without failing.",
|
|
127
199
|
},
|
|
128
200
|
GE000: {
|
|
129
201
|
headline: 'Cannot read enrichment mirror file: {0}',
|
|
130
|
-
|
|
202
|
+
severity: 'error',
|
|
203
|
+
detail: 'The drift check could not read this mirror file (permissions, a broken\nsymlink, or a race with a concurrent write).\n\nFix — make the file readable and re-run `ts-runtypes enrich --no-emit`.',
|
|
131
204
|
},
|
|
132
205
|
GE001: {
|
|
133
|
-
headline: 'Mirror location drift — the source maps to `{0}` but this file lives at `{1}`; re-run `ts-runtypes
|
|
134
|
-
|
|
206
|
+
headline: 'Mirror location drift — the source maps to `{0}` but this file lives at `{1}`; re-run `ts-runtypes enrich` to relocate.',
|
|
207
|
+
severity: 'warning',
|
|
208
|
+
detail: 'Each source file mirrors to ONE computed path per family under the\nenrich root (friendly/… and mock/…, plus per-locale translation twins).\nThis file is not at its computed location — usually after a source move,\na genDir change, or a pre-split combined mirror that still needs\nmigrating.\n\nFix — re-run the generator; it writes the per-family files at the right\npaths and migrates a legacy combined mirror:\n ts-runtypes enrich <source.ts> <Type> --update',
|
|
135
209
|
},
|
|
136
210
|
GE002: {
|
|
137
|
-
headline: 'Breadcrumb source `{0}` no longer exists ({1}) — the mirror is orphaned; delete it or re-run `ts-runtypes
|
|
211
|
+
headline: 'Breadcrumb source `{0}` no longer exists ({1}) — the mirror is orphaned; delete it or re-run `ts-runtypes enrich`.',
|
|
212
|
+
severity: 'error',
|
|
138
213
|
detail: "The mirror's `import type { … } from '<source>'` breadcrumb resolves to\na file that is gone. Its consts describe types that no longer exist\nanywhere.\n\nFix — if the source was deleted, delete the mirror file (both family\nfiles and any translation twins).\nFix — if the source moved, re-run the generator from the new location\nand prune the old mirror.",
|
|
139
214
|
},
|
|
140
215
|
GE003: {
|
|
141
|
-
headline: 'Source {0} no longer declares type `{1}` — re-run `ts-runtypes
|
|
142
|
-
|
|
216
|
+
headline: 'Source {0} no longer declares type `{1}` — re-run `ts-runtypes enrich`.',
|
|
217
|
+
severity: 'error',
|
|
218
|
+
detail: 'The mirror imports a type name its source file no longer declares (the\ntype was renamed or removed). The reconcile turns its consts into\n`@rtOrphan` carcasses so your authored values survive.\n\nFix — re-run the reconcile against the current source, then prune any\ncarcasses that should not come back:\n ts-runtypes enrich <source.ts> <Type> --update\n ts-runtypes enrich --prune',
|
|
143
219
|
},
|
|
144
220
|
HUK010: {
|
|
145
221
|
headline: 'Property `{0}` is a function — `hasUnknownKeys` does not handle function values, so this property is silently not checked.',
|
|
222
|
+
severity: 'warning',
|
|
146
223
|
detail: '`hasUnknownKeys` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
147
224
|
},
|
|
148
225
|
JCP001: {
|
|
149
226
|
headline: 'Internal error: JSON composite `{0}` references primitive entry `{1}` (type `{2}`) which was never rendered — please file an issue.',
|
|
227
|
+
severity: 'error',
|
|
150
228
|
},
|
|
151
229
|
MD001: {
|
|
152
230
|
headline: 'Unknown field `{0}` — the type does not declare it, so this MockData entry is dead.',
|
|
153
|
-
|
|
231
|
+
severity: 'error',
|
|
232
|
+
detail: "The MockData map names a field the source type does not have (removed,\nrenamed, or a typo). Its pool/range can never feed a generated mock.\n\nExample — `nick` no longer exists on the type:\n interface User { name: string }\n export const mockUser: MockData<User> = {\n name: {pool: ['Ada', 'Linus']},\n- nick: {pool: ['ada99']},\n };\n\nFix — remove the entry, or re-run the reconcile so the mirror follows\nthe type:\n ts-runtypes enrich <source.ts> <Type> --update",
|
|
154
233
|
},
|
|
155
234
|
MD011: {
|
|
156
235
|
headline: 'Property `{0}` collides with the reserved `rt$` enrichment prefix — the type cannot be enriched.',
|
|
236
|
+
severity: 'error',
|
|
157
237
|
detail: '`rt$`-prefixed keys are reserved for enrichment meta (`rt$items`,\n`rt$length`, `rt$optional`, …); a source property with that prefix is\nindistinguishable from node meta, so gen refuses the type and the\nMockData checker reports it here.\n\nFix — rename the property (a plain `$` prefix is fine; only `rt$` is\nreserved):\n interface Config {\n- rt$size: number;\n+ $size: number;\n }',
|
|
158
238
|
},
|
|
159
239
|
MD020: {
|
|
160
240
|
headline: 'Unfilled `@todo` placeholder — fill in the real sample pools/ranges, then delete the `@todo` line.',
|
|
241
|
+
severity: 'error',
|
|
161
242
|
detail: "The generator stamps a `@todo` line on every freshly-scaffolded const in\na MockData mirror file. It means \"this skeleton still carries generated\nblanks\". A clean, committed mirror has none.\n\nExample — a fresh scaffold:\n /** @rtType User#a1b2c3 @rtIds {name: d4e5f6} */\n- // @todo: generated skeleton — fill in real data, then delete this line\n export const mockUser: MockData<User> = {\n- name: {pool: []},\n+ name: {pool: ['Ada Lovelace', 'Linus Torvalds']},\n };\n\nFix — author realistic sample pools/ranges for the const, then delete\nthe whole `@todo` line (the compiler never removes it for you).",
|
|
162
243
|
},
|
|
163
244
|
MD021: {
|
|
164
|
-
headline: 'Stale `@rtOrphan` carcass — run `ts-runtypes
|
|
165
|
-
|
|
245
|
+
headline: 'Stale `@rtOrphan` carcass — run `ts-runtypes enrich --prune` to remove it (or restore the type).',
|
|
246
|
+
severity: 'error',
|
|
247
|
+
detail: 'The reconcile commented this MockData const out because its source type\nwas deleted or renamed. The carcass preserves your authored pools and\nranges so a reappearing type can restore them — but a clean, committed\nmirror has none.\n\nFix — if the type is really gone, prune the carcass:\n ts-runtypes enrich --prune\n\nFix — if the type was renamed, re-run the reconcile; a matching carcass\nis restored with your values intact:\n ts-runtypes enrich <source.ts> <NewName> --update',
|
|
166
248
|
},
|
|
167
249
|
MD022: {
|
|
168
|
-
headline: 'Stale `@rtOrphanChild` field carcass — run `ts-runtypes
|
|
169
|
-
|
|
250
|
+
headline: 'Stale `@rtOrphanChild` field carcass — run `ts-runtypes enrich --prune` to remove it (or restore the field).',
|
|
251
|
+
severity: 'error',
|
|
252
|
+
detail: "The reconcile commented this field out because the source type no longer\ndeclares it. The carcass preserves your authored value inline — but a\nclean, committed mirror has none.\n\nExample:\n export const mockUser: MockData<User> = {\n- /* @rtOrphanChild nick: {pool: ['ada99']}, */\n name: {pool: ['Ada', 'Linus']},\n };\n\nFix — if the field is really gone: `ts-runtypes enrich --prune`.\nFix — if the field was renamed, re-run `--update`; the authored value\nmoves to the renamed field when the ids match.",
|
|
253
|
+
},
|
|
254
|
+
MD023: {
|
|
255
|
+
headline: 'Unfilled blank value — a scaffolded sample pool or range is still empty; fill in real data.',
|
|
256
|
+
severity: 'error',
|
|
257
|
+
detail: "An empty pool (`pool: []`) is a generated blank that never got authored —\nit mocks nothing, so it is exactly as incomplete as a `@todo` marker.\nThis is why removing the `@todo` line without filling the values is not\n\"done\".\n\nExample:\n export const mockUser: MockData<User> = {\n- name: {pool: []},\n+ name: {pool: ['Ada Lovelace', 'Linus Torvalds']},\n };\n\nFix — author realistic sample data. Only the completeness gate\n(`ts-runtypes enrich --require-complete`) fails on it; a plain\n`--no-emit` health check reports it without failing.",
|
|
170
258
|
},
|
|
171
259
|
MKR001: {
|
|
172
260
|
headline: '`{0}()` is being called at runtime just so the marker can read its return type — side effects, throws, or async work run for nothing.',
|
|
173
|
-
|
|
261
|
+
severity: 'warning',
|
|
262
|
+
detail: 'Reflect-form markers (`createValidateFn(value)`, `getRunTypeId(value)`)\ninvoke their argument expression at runtime; the value is then discarded —\nonly its inferred type is used.\n\nFix — use the static form with `ReturnType<>`:\n - const isUser = createValidateFn({0}());\n+ const isUser = createValidateFn<ReturnType<typeof {0}>>();\n\nFix — pass an existing value of the desired type:\n const existingUser: User = ...;\n const isUser = getRunTypeId(existingUser);',
|
|
174
263
|
},
|
|
175
264
|
MKR003: {
|
|
176
265
|
headline: 'Marker call is inside a generic function — the type argument is unresolved, so no id can be computed at build time.',
|
|
177
|
-
|
|
266
|
+
severity: 'error',
|
|
267
|
+
detail: "The build can only compute an id for a concrete type (`User`,\n`{name: string}`, etc.). A type parameter like `T` is abstract — it\ntakes a different value at each call site of the surrounding function,\nso a single id can't represent it.\n\nFix — inline the marker at each concrete call site:\n function isUser(value: unknown) {\n return createValidateFn<User>()(value);\n }\n\nFix — accept a pre-computed id from the caller:\n function makeChecker<T>(id: InjectRunTypeId<T>) {\n return createValidateFn<T>(id);\n }\n const isUser = makeChecker<User>(getRunTypeId<User>());",
|
|
178
268
|
},
|
|
179
269
|
MKR004: {
|
|
180
270
|
headline: "`noLiterals: true` has no effect here — the type argument doesn't resolve to literal values.",
|
|
181
|
-
|
|
271
|
+
severity: 'warning',
|
|
272
|
+
detail: "The `noLiterals` validate option skips the exact-value check that literal\ntypes (`'admin'`, `42`, `true`) compile to. This call's type argument\nresolves to a non-literal type, so there is no literal check to skip and\nthe option is a silent no-op.\n\nFix — drop the option:\n- const isRole = createValidateFn<string>({noLiterals: true});\n+ const isRole = createValidateFn<string>();\n\nOr, if you meant to relax a literal union, point the option at the type\nthat actually carries the literals:\n const isRole = createValidateFn<'admin' | 'user'>({noLiterals: true});",
|
|
182
273
|
},
|
|
183
274
|
MKR005: {
|
|
184
275
|
headline: '`noIsArrayCheck: true` has no effect here — the type argument is not an array type.',
|
|
185
|
-
|
|
276
|
+
severity: 'warning',
|
|
277
|
+
detail: "The `noIsArrayCheck` validate option skips the `Array.isArray` guard that\narray types compile to. This call's type argument resolves to a non-array\ntype, so there is no guard to skip and the option is a silent no-op.\n\nFix — drop the option:\n- const isUser = createValidateFn<User>({noIsArrayCheck: true});\n+ const isUser = createValidateFn<User>();\n\nOr point it at the array type you meant:\n const isUsers = createValidateFn<User[]>({noIsArrayCheck: true});",
|
|
186
278
|
},
|
|
187
279
|
MKR006: {
|
|
188
280
|
headline: '`InjectTypeFnArgs` names the function family `{0}` more than once — remove the duplicate key.',
|
|
281
|
+
severity: 'error',
|
|
189
282
|
detail: "An `InjectTypeFnArgs<T, …>` marker names each function family it needs for\n`T` once, in declaration order; the build injects one entry-module tuple\nper name and the wrapper forwards each to its factory. Naming a family\ntwice would inject a redundant identical tuple with no consumer, so it is\nalmost always a copy-paste slip and the build stops.\n\nFix — name each family at most once:\n- id?: InjectTypeFnArgs<T, 'verr', 'jsonDecoder', 'verr'>;\n+ id?: InjectTypeFnArgs<T, 'verr', 'jsonDecoder', 'jsonEncoder'>;",
|
|
190
283
|
},
|
|
191
284
|
MKR007: {
|
|
192
285
|
headline: 'Marker type resolved to `any` because this file has an unresolved import (`{0}`) — the generated functions would silently accept anything.',
|
|
286
|
+
severity: 'error',
|
|
193
287
|
detail: "TypeScript could not resolve the import, so the type it should have\nprovided checked as `any` at this marker call. A validator over `any` is\nthe always-true identity, a mock over `any` is `undefined`, and encoders\npass values through untouched — with no runtime signal that anything is\nwrong. This usually means the build tool and the type scanner resolve\nmodules differently (e.g. an extensionless relative import under\n`moduleResolution: NodeNext`, a missing dependency, or a `paths` alias the\nscan tsconfig doesn't declare).\n\nFix — make the import resolve for the type scanner:\n- import {User} from './user.runtype';\n+ import {User} from './user.runtype.ts';\n\nOr align the tsconfig the plugin scans with the one your bundler uses.\nIf the `any` is genuinely intentional, write the marker over an alias\ndeclared in resolving code (e.g. `type Loose = any`) in a file with no\nfailing imports.",
|
|
194
288
|
},
|
|
289
|
+
MKR008: {
|
|
290
|
+
headline: 'This type is too deeply nested to reflect — computing its structural id hit the recursion depth cap, so the build stops here instead of crashing.',
|
|
291
|
+
severity: 'error',
|
|
292
|
+
detail: 'The build computes a structural id by walking the type, and the walk is\ncapped at a depth far beyond any realistic shape. Hitting the cap with no\nsingle recurring type on the path means literally written (or generated)\nnesting hundreds of levels deep.\n\nFix — reflect a concrete, bounded projection of the type (e.g. the element\nor data type you actually send), or restructure the recursion so the same\nnamed type recurs by reference (a plain recursive interface is fine).',
|
|
293
|
+
},
|
|
294
|
+
MKR009: {
|
|
295
|
+
headline: 'Type `{0}` re-instantiates itself with fresh type arguments at every level (a self-instantiating generic), so its structural id never resolves. Reflect a monomorphic shape instead.',
|
|
296
|
+
severity: 'error',
|
|
297
|
+
detail: "A generic method's own type parameters (the `U` in `map<U>(fn: (x: T) => U):\nIter<U>`) are bound at each CALL of the method, so they can never be resolved\nwhile reflecting the containing type — and when such a method returns a fresh\ninstantiation of its own container, the type graph grows a new level forever.\nRenaming the type parameters does not resolve them; the fix is a monomorphic\n(fully resolved) recursive shape, which closes by reference:\n\n- interface Iter<T> { map<U>(fn: (x: T) => U): Iter<U> }\n+ interface NumberIter { map(fn: (x: string) => number): NumberIter }\n\nOrdinary generics are unaffected: instantiated types (Map<string, User>, a\nconcrete Iter<string>'s data members) and generic methods that do not\nre-instantiate their container reflect fine. Validators also drop methods\nentirely (methods aren't data), so reflecting just the data shape usually\nsidesteps the problem.",
|
|
298
|
+
},
|
|
299
|
+
MKR010: {
|
|
300
|
+
headline: 'Type argument contains the unresolved type parameter `{0}` — a generic must be fully resolved at the marker call, so no id can be computed. See Related for where `{0}` is declared.',
|
|
301
|
+
severity: 'error',
|
|
302
|
+
detail: "The build can only compute an id for a fully concrete type. `{0}` is a type\nparameter of the surrounding generic — it takes a different type at each call\nsite, so a single build-time id would alias every instantiation onto one\n(wrong) shape. A parameter DEFAULT does not help here: defaults resolve where\na caller omits the argument, never inside the generic's own body.\n\nFix — resolve the generic before reflecting it:\n interface Box<T> { value: T }\n type BoxString = Box<string>;\n const isBoxString = createValidateFn<BoxString>(); // resolved — ok\n\nFix — or accept a pre-computed id from the caller and inline the marker at\neach concrete call site (same patterns as MKR003):\n function makeChecker<T>(id: InjectRunTypeId<T>) {\n return createValidateFn<T>(id);\n }\n const isBox = makeChecker<Box<string>>(getRunTypeId<Box<string>>());\n\nGeneric METHODS on a concrete type (`find<T>(query: string): T[]`) are\nunaffected — their own type parameters are bound per call of the method and\nmethods aren't data.",
|
|
303
|
+
},
|
|
304
|
+
MKR011: {
|
|
305
|
+
headline: 'Generic type `{0}` is used without its required type argument(s) — parameter `{1}` has no default, so the type cannot resolve to an id. See Related for where `{1}` is declared.',
|
|
306
|
+
severity: 'error',
|
|
307
|
+
detail: "TypeScript itself rejects this usage (TS2314), but dev-server builds don't\nrun the type checker, so the scan reads the written type arguments and stops\nthe build here instead of silently reflecting `any` (a validator over `any`\naccepts everything).\n\nFix — pass the missing type argument:\n- const isA = createValidateFn<A>();\n+ const isA = createValidateFn<A<string>>();\n\nFix — or give the parameter a default, which the compiler resolves at every\nbare use site:\n- interface A<S extends string> { a: S }\n+ interface A<S extends string = string> { a: S }\n const isA = createValidateFn<A>(); // now resolves to A<string>",
|
|
308
|
+
},
|
|
195
309
|
NE001: {
|
|
196
310
|
headline: 'Property `{0}` is tagged @nonEnumerable but is required — the guard only applies to optional properties, so the tag has no effect. Make it optional (`{0}?`) or remove the tag.',
|
|
311
|
+
severity: 'error',
|
|
197
312
|
detail: "The runtime enumerability guard (which lets a value omit a property from\nthe wire when it isn't an enumerable own property) is applied ONLY to\noptional properties. That keeps the decoder's `DataOnly<T>` return type\nhonest: a guarded property is always one the type already allows to be\nabsent. A `@nonEnumerable` tag on a REQUIRED property is therefore ignored\n— the property still serializes unconditionally.\n\nFix — make the property optional:\n- /** @nonEnumerable */ token: string;\n+ /** @nonEnumerable */ token?: string;",
|
|
198
313
|
},
|
|
199
314
|
OVR001: {
|
|
200
315
|
headline: 'Duplicate override for `{0}` — there can be exactly one override per (type, function).',
|
|
316
|
+
severity: 'error',
|
|
201
317
|
detail: 'Two `overrideX<T>()` declarations target the same type and the same\nfunction family. Which one wins would depend on scan order, so a second\noverride is rejected regardless of its body. The Related: line above\npoints at the override that was registered first.\n\nFix — keep one canonical override and delete the other:\n- overrideValidate<User>((utl) => (value) => checkA(value)); // first\n- overrideValidate<User>((utl) => (value) => checkB(value)); // duplicate\n+ overrideValidate<User>((utl) => (value) => checkA(value) && checkB(value));',
|
|
202
318
|
},
|
|
203
319
|
OVR002: {
|
|
204
320
|
headline: 'Override entry `{0}` references compiled function `{1}` which did not render — this would throw at runtime, so the build stops.',
|
|
321
|
+
severity: 'error',
|
|
205
322
|
detail: "An override redirect body loads its compiled function from the cache\n(`usePureFn('cfn::…')`), but that module never rendered into the entry\ngraph. Calling the override would throw at runtime, so the build surfaces\nthe miss now. This is an internal emitter tripwire and should never fire\nin normal operation.\n\nFix — re-run with a clean cache first (delete the .runtypes cache dir /\nrestart the dev server). If it persists, the emitter dropped a module it\nshould have rendered: please open an issue with the type + override that\ntriggers it.",
|
|
206
323
|
},
|
|
207
324
|
OVR010: {
|
|
208
325
|
headline: 'Overriding `validate` for this type also changes how JSON and binary decoders narrow unions containing it.',
|
|
209
|
-
|
|
326
|
+
severity: 'warning',
|
|
327
|
+
detail: "`validate` is a shared dependency across function families: JSON and\nbinary union decoders call the member validators to pick the matching\nbranch. An `overrideValidate<T>()` therefore reaches past\n`createValidateFn<T>()` — decoders of any union containing T now narrow\nwith YOUR function.\n\nThis is informational; the build proceeds. If the override should only\naffect direct validation, give the union members a discriminant so\ndecoders never fall back to member validation:\n type Event = {kind: 'click'; x: number} | {kind: 'key'; code: string};",
|
|
210
328
|
},
|
|
211
329
|
PFE9004: {
|
|
212
330
|
headline: 'Duplicate `registerPureFnFactory` for `{0}` with a different body — only one definition can win.',
|
|
331
|
+
severity: 'error',
|
|
213
332
|
detail: 'Two calls register the same `namespace::functionId` key but the factory\nbodies differ. The cache can only hold one definition, so one call site\nsilently loses its version at runtime.\n\nFix — make all registrations identical, or pick one canonical site and\ndelete the others. The Related: line above points at the first\nregistration the extractor saw.',
|
|
214
333
|
},
|
|
215
334
|
PFE9005: {
|
|
216
335
|
headline: 'Pure-fn factory `{0}` uses destructured parameters — only simple identifier params are supported.',
|
|
336
|
+
severity: 'error',
|
|
217
337
|
detail: "The build inlines parameter references by name when it materialises the\nfactory. Destructuring patterns (`({a, b})`, `([x, y])`) don't have a\nsingle name to substitute.\n\nFix — destructure inside the body:\n - registerPureFnFactory('ns::fn', (utl) => ({a, b}) => ...);\n+ registerPureFnFactory('ns::fn', (utl) => (params) => {\n+ const {a, b} = params;\n+ return ...;\n+ });",
|
|
218
338
|
},
|
|
219
339
|
PFE9006: {
|
|
220
340
|
headline: "`this` is not allowed inside a `registerPureFnFactory` factory body — pure functions can't depend on a calling context.",
|
|
341
|
+
severity: 'error',
|
|
221
342
|
detail: "Pure functions are materialised standalone at build time; there's no\n`this` to bind to.\n\nFix — replace `this` with an explicit parameter, or move the function\nout of the class/object method that owns the `this`:\n registerPureFnFactory('ns::fn', (utl) => (self, input) => {\n return self.field + input;\n });",
|
|
222
343
|
},
|
|
223
344
|
PFE9007: {
|
|
224
345
|
headline: '`async`/`await` is not allowed inside a `registerPureFnFactory` factory body.',
|
|
346
|
+
severity: 'error',
|
|
225
347
|
detail: "Pure functions must run synchronously so the build can call them at\ncompile time. `async` introduces a Promise that won't resolve until\nruntime.\n\nFix — make the factory synchronous; move async work to the caller:\n registerPureFnFactory('ns::fn', (utl) => {\n- return async (input) => { const r = await heavy(); return r; };\n+ return (resolvedValue) => transform(resolvedValue);\n });",
|
|
226
348
|
},
|
|
227
349
|
PFE9008: {
|
|
228
350
|
headline: '`yield` / generators are not allowed inside a `registerPureFnFactory` factory body.',
|
|
351
|
+
severity: 'error',
|
|
229
352
|
detail: "Generators carry resumption state that can't be materialised\nstatically.\n\nFix — return an array or a plain iterable instead:\n registerPureFnFactory('ns::fn', (utl) => (input) => {\n return [...computeAll(input)];\n });",
|
|
230
353
|
},
|
|
231
354
|
PFE9009: {
|
|
232
355
|
headline: '`import()` is not allowed inside a `registerPureFnFactory` factory body.',
|
|
356
|
+
severity: 'error',
|
|
233
357
|
detail: 'Dynamic imports load modules at runtime — the build needs every\ndependency available statically.\n\nFix — use a top-level `import` statement, or pass the imported module\nin as a parameter.',
|
|
234
358
|
},
|
|
235
359
|
PFE9010: {
|
|
236
360
|
headline: '`{0}` is not allowed inside a `registerPureFnFactory` factory body.',
|
|
361
|
+
severity: 'error',
|
|
237
362
|
detail: "Globals like `eval`, `Function`, `fetch`, `XMLHttpRequest`, `require`,\n`process`, `globalThis`, `window`, `document` are blocked from pure-fn\nbodies — they either execute arbitrary code or depend on a runtime\nenvironment the build can't reproduce.\n\nFix — remove the reference, or pass the needed value in as a parameter.",
|
|
238
363
|
},
|
|
239
364
|
PFE9011: {
|
|
240
365
|
headline: "`{0}` is captured from outer scope inside a `registerPureFnFactory` factory — pure functions can't reach outside their own body.",
|
|
366
|
+
severity: 'error',
|
|
241
367
|
detail: "The build inlines factory bodies without their lexical environment, so\nany free variable becomes `undefined` at runtime.\n\nFix — pass `{0}` in as a parameter:\n registerPureFnFactory('ns::fn', (utl) => ({0}, value) => ...);\n\nFix — inline its value if it's a known constant:\n registerPureFnFactory('ns::fn', (utl) => (value) => {\n const {0} = 42;\n ...\n });\n\nFix — import `{0}` directly inside the factory if it's a module export.",
|
|
242
368
|
},
|
|
243
369
|
PFE9012: {
|
|
244
370
|
headline: "Pure-fn `{0}` is referenced by a RT function but never registered — call `registerPureFnFactory('{1}::{2}', …)` first.",
|
|
371
|
+
severity: 'error',
|
|
245
372
|
detail: "A RT validator/encoder calls `utl.usePureFn('{0}')` (or similar) but\nno `registerPureFnFactory` call with that namespace+function pair was\nfound in any scanned source file.\n\nFix — register the function in the expected location ({3}, if known).\nMake sure the file is included in the scan set.",
|
|
246
373
|
},
|
|
247
374
|
PFE9013: {
|
|
248
375
|
headline: '`{0}.{1}` dependency argument must be a string literal or a same-scope `const` string.',
|
|
376
|
+
severity: 'error',
|
|
249
377
|
detail: "`utl.usePureFn` / `utl.getPureFn` need a static key so the build can\nverify the referenced pure-fn is registered.\n\nFix:\n - const key = buildKey();\n- return utl.usePureFn(key)(input);\n+ return utl.usePureFn('rt::myFn')(input);",
|
|
250
378
|
},
|
|
251
379
|
PFN001: {
|
|
252
380
|
headline: '`PureFunction<F>` argument must be an INLINE arrow or function expression.',
|
|
381
|
+
severity: 'error',
|
|
253
382
|
detail: "The build extracts and AOT-compiles the function body, so it must see the\nliteral inline at the call site. A named reference — even a module-private\n`const f = …` or `function f(){}` — is not accepted, because the literal\nmust have no handle anything else can reach; the compiled copy is then the\nonly one that can run. (An imported or exported literal is rejected as PFN002.)\n\nFix — inline the function at the call site:\n- const validate = (v: unknown) => typeof v === 'string';\n- registerValidator(validate);\n+ registerValidator((v: unknown) => typeof v === 'string');",
|
|
254
383
|
},
|
|
255
384
|
PFN002: {
|
|
256
385
|
headline: '`PureFunction<F>` literal must not be imported or exported — the compiled copy must be the only one that can run.',
|
|
386
|
+
severity: 'error',
|
|
257
387
|
detail: "The build extracts and AOT-compiles the function body, and the compiled\ncopy is the single source of truth. If the original literal stays reachable\nas a value — imported from another module, or exported so another module can\nimport it — a caller could invoke the un-compiled function and diverge from\nthe compiled behaviour.\n\nUnder the literal-only rule a named binding isn't allowed at all (see PFN001),\nso the fix is to inline the function at the call site:\n- import {validate} from './validators'; // imported — rejected\n- export const validate = (v) => …; // exported — rejected\n+ registerValidator((v: unknown) => typeof v === 'string'); // inline — ok",
|
|
258
388
|
},
|
|
259
389
|
PJ001: {
|
|
260
|
-
headline: '
|
|
390
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
391
|
+
severity: 'error',
|
|
261
392
|
detail: "`never` is the empty type — no value can ever inhabit it. A field\ntyped `never` cannot carry a runtime value, so there is nothing to\nencode/decode/validate.\n\nFix — use `unknown` if you really want to accept any value:\n interface User {\n- tag: never;\n+ tag: unknown; // narrow before use\n }\n\nFix — pick a concrete type matching your real data:\n interface User {\n- tag: never;\n+ tag: 'pending' | 'active' | 'done';\n }",
|
|
262
393
|
},
|
|
263
394
|
PJ002: {
|
|
264
|
-
headline: '
|
|
395
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
396
|
+
severity: 'error',
|
|
265
397
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
266
398
|
},
|
|
267
399
|
PJ003: {
|
|
268
|
-
headline: '
|
|
400
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
401
|
+
severity: 'error',
|
|
269
402
|
detail: "Functions have no value form to serialise — their closure, prototype,\nand bound state aren't representable in JSON or binary.\n\nFix — drop the function from your type, or replace it with the data the\nfunction would produce:\n interface User {\n- getName: () => string;\n+ name: string;\n }",
|
|
270
403
|
},
|
|
271
404
|
PJ004: {
|
|
272
|
-
headline: '
|
|
405
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
406
|
+
severity: 'error',
|
|
273
407
|
detail: "Arrays of un-serialisable elements (`symbol[]`, `(() => void)[]`,\n`Map<K, V>[]`, etc.) can't be encoded — every element would need to be\nrepresentable, and these aren't. Dropping individual elements would\nchange the array length, so the encoder refuses rather than silently\nshipping a different shape.\n\nFix — change the element type to something serialisable:\n - type Items = (() => void)[];\n+ type Items = string[];",
|
|
274
408
|
},
|
|
275
409
|
PJ005: {
|
|
276
|
-
headline: '
|
|
410
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
411
|
+
severity: 'error',
|
|
277
412
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
278
413
|
},
|
|
279
414
|
PJ010: {
|
|
280
415
|
headline: 'Property `{0}` is a function — `prepareForJson` does not handle function values, so this property is silently not encoded.',
|
|
416
|
+
severity: 'warning',
|
|
281
417
|
detail: '`prepareForJson` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
282
418
|
},
|
|
283
419
|
PJ011: {
|
|
284
420
|
headline: "Method `{0}` is silently not encoded by `prepareForJson` — methods aren't data.",
|
|
421
|
+
severity: 'warning',
|
|
285
422
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`prepareForJson` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
286
423
|
},
|
|
287
424
|
PJ012: {
|
|
288
425
|
headline: "Static member `{0}` is silently not encoded by `prepareForJson` — statics aren't part of instance data.",
|
|
426
|
+
severity: 'warning',
|
|
289
427
|
detail: 'Class static members live on the class, not on individual instances.\n`prepareForJson` operates on instance shape, so statics are excluded.',
|
|
290
428
|
},
|
|
291
429
|
PJ013: {
|
|
292
430
|
headline: "Symbol-keyed property `{0}` is silently not encoded by `prepareForJson` — symbol keys aren't JSON-representable.",
|
|
431
|
+
severity: 'warning',
|
|
293
432
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `prepareForJson` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
294
433
|
},
|
|
295
434
|
PJ014: {
|
|
296
435
|
headline: "Union member(s) of type `{0}` can't be represented as data — `prepareForJson` drops them, so the union is encoded as its remaining members.",
|
|
436
|
+
severity: 'warning',
|
|
297
437
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `prepareForJson` encoded only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `prepareForJson` throws at build time instead.',
|
|
298
438
|
},
|
|
299
439
|
PJ015: {
|
|
300
440
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `prepareForJson` drops it, so this property is silently not encoded.',
|
|
441
|
+
severity: 'warning',
|
|
301
442
|
detail: '`prepareForJson` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `prepareForJson` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
302
443
|
},
|
|
303
444
|
PJS001: {
|
|
304
|
-
headline: '
|
|
445
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
446
|
+
severity: 'error',
|
|
305
447
|
detail: "`never` is the empty type — no value can ever inhabit it. A field\ntyped `never` cannot carry a runtime value, so there is nothing to\nencode/decode/validate.\n\nFix — use `unknown` if you really want to accept any value:\n interface User {\n- tag: never;\n+ tag: unknown; // narrow before use\n }\n\nFix — pick a concrete type matching your real data:\n interface User {\n- tag: never;\n+ tag: 'pending' | 'active' | 'done';\n }",
|
|
306
448
|
},
|
|
307
449
|
PJS002: {
|
|
308
|
-
headline: '
|
|
450
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
451
|
+
severity: 'error',
|
|
309
452
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
310
453
|
},
|
|
311
454
|
PJS003: {
|
|
312
|
-
headline: '
|
|
455
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
456
|
+
severity: 'error',
|
|
313
457
|
detail: "Functions have no value form to serialise — their closure, prototype,\nand bound state aren't representable in JSON or binary.\n\nFix — drop the function from your type, or replace it with the data the\nfunction would produce:\n interface User {\n- getName: () => string;\n+ name: string;\n }",
|
|
314
458
|
},
|
|
315
459
|
PJS004: {
|
|
316
|
-
headline: '
|
|
460
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
461
|
+
severity: 'error',
|
|
317
462
|
detail: "Arrays of un-serialisable elements (`symbol[]`, `(() => void)[]`,\n`Map<K, V>[]`, etc.) can't be encoded — every element would need to be\nrepresentable, and these aren't. Dropping individual elements would\nchange the array length, so the encoder refuses rather than silently\nshipping a different shape.\n\nFix — change the element type to something serialisable:\n - type Items = (() => void)[];\n+ type Items = string[];",
|
|
318
463
|
},
|
|
319
464
|
PJS005: {
|
|
320
|
-
headline: '
|
|
465
|
+
headline: 'Type `{0}` can never be encoded to JSON — the generated function will always fail.',
|
|
466
|
+
severity: 'error',
|
|
321
467
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
322
468
|
},
|
|
323
469
|
PJS010: {
|
|
324
470
|
headline: 'Property `{0}` is a function — `prepareForJsonSafe` does not handle function values, so this property is silently not encoded.',
|
|
471
|
+
severity: 'warning',
|
|
325
472
|
detail: '`prepareForJsonSafe` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
326
473
|
},
|
|
327
474
|
PJS011: {
|
|
328
475
|
headline: "Method `{0}` is silently not encoded by `prepareForJsonSafe` — methods aren't data.",
|
|
476
|
+
severity: 'warning',
|
|
329
477
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`prepareForJsonSafe` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
330
478
|
},
|
|
331
479
|
PJS012: {
|
|
332
480
|
headline: "Static member `{0}` is silently not encoded by `prepareForJsonSafe` — statics aren't part of instance data.",
|
|
481
|
+
severity: 'warning',
|
|
333
482
|
detail: 'Class static members live on the class, not on individual instances.\n`prepareForJsonSafe` operates on instance shape, so statics are excluded.',
|
|
334
483
|
},
|
|
335
484
|
PJS013: {
|
|
336
485
|
headline: "Symbol-keyed property `{0}` is silently not encoded by `prepareForJsonSafe` — symbol keys aren't JSON-representable.",
|
|
486
|
+
severity: 'warning',
|
|
337
487
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `prepareForJsonSafe` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
338
488
|
},
|
|
339
489
|
PJS014: {
|
|
340
490
|
headline: "Union member(s) of type `{0}` can't be represented as data — `prepareForJsonSafe` drops them, so the union is encoded as its remaining members.",
|
|
491
|
+
severity: 'warning',
|
|
341
492
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `prepareForJsonSafe` encoded only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `prepareForJsonSafe` throws at build time instead.',
|
|
342
493
|
},
|
|
343
494
|
PJS015: {
|
|
344
495
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `prepareForJsonSafe` drops it, so this property is silently not encoded.',
|
|
496
|
+
severity: 'warning',
|
|
345
497
|
detail: '`prepareForJsonSafe` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `prepareForJsonSafe` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
346
498
|
},
|
|
347
499
|
RJ001: {
|
|
348
|
-
headline: '
|
|
500
|
+
headline: 'Type `{0}` can never be decoded from JSON — the generated function will always fail.',
|
|
501
|
+
severity: 'error',
|
|
349
502
|
detail: "`never` is the empty type — no value can ever inhabit it. A field\ntyped `never` cannot carry a runtime value, so there is nothing to\nencode/decode/validate.\n\nFix — use `unknown` if you really want to accept any value:\n interface User {\n- tag: never;\n+ tag: unknown; // narrow before use\n }\n\nFix — pick a concrete type matching your real data:\n interface User {\n- tag: never;\n+ tag: 'pending' | 'active' | 'done';\n }",
|
|
350
503
|
},
|
|
351
504
|
RJ002: {
|
|
352
|
-
headline: '
|
|
505
|
+
headline: 'Type `{0}` can never be decoded from JSON — the generated function will always fail.',
|
|
506
|
+
severity: 'error',
|
|
353
507
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
354
508
|
},
|
|
355
509
|
RJ003: {
|
|
356
|
-
headline: '
|
|
510
|
+
headline: 'Type `{0}` can never be decoded from JSON — the generated function will always fail.',
|
|
511
|
+
severity: 'error',
|
|
357
512
|
detail: "Functions have no value form to serialise — their closure, prototype,\nand bound state aren't representable in JSON or binary.\n\nFix — drop the function from your type, or replace it with the data the\nfunction would produce:\n interface User {\n- getName: () => string;\n+ name: string;\n }",
|
|
358
513
|
},
|
|
359
514
|
RJ004: {
|
|
360
|
-
headline: '
|
|
515
|
+
headline: 'Type `{0}` can never be decoded from JSON — the generated function will always fail.',
|
|
516
|
+
severity: 'error',
|
|
361
517
|
detail: "Arrays of un-serialisable elements (`symbol[]`, `(() => void)[]`,\n`Map<K, V>[]`, etc.) can't be encoded — every element would need to be\nrepresentable, and these aren't. Dropping individual elements would\nchange the array length, so the encoder refuses rather than silently\nshipping a different shape.\n\nFix — change the element type to something serialisable:\n - type Items = (() => void)[];\n+ type Items = string[];",
|
|
362
518
|
},
|
|
363
519
|
RJ005: {
|
|
364
|
-
headline: '
|
|
520
|
+
headline: 'Type `{0}` can never be decoded from JSON — the generated function will always fail.',
|
|
521
|
+
severity: 'error',
|
|
365
522
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
366
523
|
},
|
|
367
524
|
RJ010: {
|
|
368
525
|
headline: 'Property `{0}` is a function — `restoreFromJson` does not handle function values, so this property is silently not decoded.',
|
|
526
|
+
severity: 'warning',
|
|
369
527
|
detail: '`restoreFromJson` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
370
528
|
},
|
|
371
529
|
RJ011: {
|
|
372
530
|
headline: "Method `{0}` is silently not decoded by `restoreFromJson` — methods aren't data.",
|
|
531
|
+
severity: 'warning',
|
|
373
532
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`restoreFromJson` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
374
533
|
},
|
|
375
534
|
RJ012: {
|
|
376
535
|
headline: "Static member `{0}` is silently not decoded by `restoreFromJson` — statics aren't part of instance data.",
|
|
536
|
+
severity: 'warning',
|
|
377
537
|
detail: 'Class static members live on the class, not on individual instances.\n`restoreFromJson` operates on instance shape, so statics are excluded.',
|
|
378
538
|
},
|
|
379
539
|
RJ013: {
|
|
380
540
|
headline: "Symbol-keyed property `{0}` is silently not decoded by `restoreFromJson` — symbol keys aren't JSON-representable.",
|
|
541
|
+
severity: 'warning',
|
|
381
542
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `restoreFromJson` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
382
543
|
},
|
|
383
544
|
RJ014: {
|
|
384
545
|
headline: "Union member(s) of type `{0}` can't be represented as data — `restoreFromJson` drops them, so the union is decoded as its remaining members.",
|
|
546
|
+
severity: 'warning',
|
|
385
547
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `restoreFromJson` decoded only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `restoreFromJson` throws at build time instead.',
|
|
386
548
|
},
|
|
387
549
|
RJ015: {
|
|
388
550
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `restoreFromJson` drops it, so this property is silently not decoded.',
|
|
551
|
+
severity: 'warning',
|
|
389
552
|
detail: '`restoreFromJson` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `restoreFromJson` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
390
553
|
},
|
|
391
554
|
SJ001: {
|
|
392
|
-
headline: '
|
|
555
|
+
headline: 'Type `{0}` can never be stringified to JSON — the generated function will always fail.',
|
|
556
|
+
severity: 'error',
|
|
393
557
|
detail: "`never` is the empty type — no value can ever inhabit it. A field\ntyped `never` cannot carry a runtime value, so there is nothing to\nencode/decode/validate.\n\nFix — use `unknown` if you really want to accept any value:\n interface User {\n- tag: never;\n+ tag: unknown; // narrow before use\n }\n\nFix — pick a concrete type matching your real data:\n interface User {\n- tag: never;\n+ tag: 'pending' | 'active' | 'done';\n }",
|
|
394
558
|
},
|
|
395
559
|
SJ002: {
|
|
396
|
-
headline: '
|
|
560
|
+
headline: 'Type `{0}` can never be stringified to JSON — the generated function will always fail.',
|
|
561
|
+
severity: 'error',
|
|
397
562
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
398
563
|
},
|
|
399
564
|
SJ003: {
|
|
400
|
-
headline: '
|
|
565
|
+
headline: 'Type `{0}` can never be stringified to JSON — the generated function will always fail.',
|
|
566
|
+
severity: 'error',
|
|
401
567
|
detail: "Functions have no value form to serialise — their closure, prototype,\nand bound state aren't representable in JSON or binary.\n\nFix — drop the function from your type, or replace it with the data the\nfunction would produce:\n interface User {\n- getName: () => string;\n+ name: string;\n }",
|
|
402
568
|
},
|
|
403
569
|
SJ004: {
|
|
404
|
-
headline: '
|
|
570
|
+
headline: 'Type `{0}` can never be stringified to JSON — the generated function will always fail.',
|
|
571
|
+
severity: 'error',
|
|
405
572
|
detail: "Arrays of un-serialisable elements (`symbol[]`, `(() => void)[]`,\n`Map<K, V>[]`, etc.) can't be encoded — every element would need to be\nrepresentable, and these aren't. Dropping individual elements would\nchange the array length, so the encoder refuses rather than silently\nshipping a different shape.\n\nFix — change the element type to something serialisable:\n - type Items = (() => void)[];\n+ type Items = string[];",
|
|
406
573
|
},
|
|
407
574
|
SJ005: {
|
|
408
|
-
headline: '
|
|
575
|
+
headline: 'Type `{0}` can never be stringified to JSON — the generated function will always fail.',
|
|
576
|
+
severity: 'error',
|
|
409
577
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
410
578
|
},
|
|
411
579
|
SJ010: {
|
|
412
580
|
headline: 'Property `{0}` is a function — `stringifyJson` does not handle function values, so this property is silently not stringified.',
|
|
581
|
+
severity: 'warning',
|
|
413
582
|
detail: '`stringifyJson` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
414
583
|
},
|
|
415
584
|
SJ011: {
|
|
416
585
|
headline: "Method `{0}` is silently not stringified by `stringifyJson` — methods aren't data.",
|
|
586
|
+
severity: 'warning',
|
|
417
587
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`stringifyJson` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
418
588
|
},
|
|
419
589
|
SJ012: {
|
|
420
590
|
headline: "Static member `{0}` is silently not stringified by `stringifyJson` — statics aren't part of instance data.",
|
|
591
|
+
severity: 'warning',
|
|
421
592
|
detail: 'Class static members live on the class, not on individual instances.\n`stringifyJson` operates on instance shape, so statics are excluded.',
|
|
422
593
|
},
|
|
423
594
|
SJ013: {
|
|
424
595
|
headline: "Symbol-keyed property `{0}` is silently not stringified by `stringifyJson` — symbol keys aren't JSON-representable.",
|
|
596
|
+
severity: 'warning',
|
|
425
597
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `stringifyJson` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
426
598
|
},
|
|
427
599
|
SJ014: {
|
|
428
600
|
headline: "Union member(s) of type `{0}` can't be represented as data — `stringifyJson` drops them, so the union is stringified as its remaining members.",
|
|
601
|
+
severity: 'warning',
|
|
429
602
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `stringifyJson` stringified only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `stringifyJson` throws at build time instead.',
|
|
430
603
|
},
|
|
431
604
|
SJ015: {
|
|
432
605
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `stringifyJson` drops it, so this property is silently not stringified.',
|
|
606
|
+
severity: 'warning',
|
|
433
607
|
detail: '`stringifyJson` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `stringifyJson` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
434
608
|
},
|
|
435
|
-
SUK010: {
|
|
436
|
-
headline: 'Property `{0}` is a function — `stripUnknownKeys` does not handle function values, so this property is silently not stripped.',
|
|
437
|
-
detail: '`stripUnknownKeys` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
438
|
-
},
|
|
439
609
|
TB001: {
|
|
440
|
-
headline: '
|
|
610
|
+
headline: 'Type `{0}` can never be serialised to binary — the generated function will always fail.',
|
|
611
|
+
severity: 'error',
|
|
441
612
|
detail: "`never` is the empty type — no value can ever inhabit it. A field\ntyped `never` cannot carry a runtime value, so there is nothing to\nencode/decode/validate.\n\nFix — use `unknown` if you really want to accept any value:\n interface User {\n- tag: never;\n+ tag: unknown; // narrow before use\n }\n\nFix — pick a concrete type matching your real data:\n interface User {\n- tag: never;\n+ tag: 'pending' | 'active' | 'done';\n }",
|
|
442
613
|
},
|
|
443
614
|
TB002: {
|
|
444
|
-
headline: '
|
|
615
|
+
headline: 'Type `{0}` can never be serialised to binary — the generated function will always fail.',
|
|
616
|
+
severity: 'error',
|
|
445
617
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
446
618
|
},
|
|
447
619
|
TB003: {
|
|
448
|
-
headline: '
|
|
620
|
+
headline: 'Type `{0}` can never be serialised to binary — the generated function will always fail.',
|
|
621
|
+
severity: 'error',
|
|
449
622
|
detail: "Functions have no value form to serialise — their closure, prototype,\nand bound state aren't representable in JSON or binary.\n\nFix — drop the function from your type, or replace it with the data the\nfunction would produce:\n interface User {\n- getName: () => string;\n+ name: string;\n }",
|
|
450
623
|
},
|
|
451
624
|
TB004: {
|
|
452
|
-
headline: '
|
|
625
|
+
headline: 'Type `{0}` can never be serialised to binary — the generated function will always fail.',
|
|
626
|
+
severity: 'error',
|
|
453
627
|
detail: "Arrays of un-serialisable elements (`symbol[]`, `(() => void)[]`,\n`Map<K, V>[]`, etc.) can't be encoded — every element would need to be\nrepresentable, and these aren't. Dropping individual elements would\nchange the array length, so the encoder refuses rather than silently\nshipping a different shape.\n\nFix — change the element type to something serialisable:\n - type Items = (() => void)[];\n+ type Items = string[];",
|
|
454
628
|
},
|
|
455
629
|
TB005: {
|
|
456
|
-
headline: '
|
|
630
|
+
headline: 'Type `{0}` can never be serialised to binary — the generated function will always fail.',
|
|
631
|
+
severity: 'error',
|
|
457
632
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
458
633
|
},
|
|
459
634
|
TB006: {
|
|
460
|
-
headline: '
|
|
635
|
+
headline: 'Type `{0}` can never be serialised to binary — the generated function will always fail.',
|
|
636
|
+
severity: 'error',
|
|
461
637
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
462
638
|
},
|
|
463
639
|
TB010: {
|
|
464
640
|
headline: 'Property `{0}` is a function — `toBinary` does not handle function values, so this property is silently not serialised.',
|
|
641
|
+
severity: 'warning',
|
|
465
642
|
detail: '`toBinary` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
466
643
|
},
|
|
467
644
|
TB011: {
|
|
468
645
|
headline: "Method `{0}` is silently not serialised by `toBinary` — methods aren't data.",
|
|
646
|
+
severity: 'warning',
|
|
469
647
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`toBinary` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
470
648
|
},
|
|
471
649
|
TB012: {
|
|
472
650
|
headline: "Static member `{0}` is silently not serialised by `toBinary` — statics aren't part of instance data.",
|
|
651
|
+
severity: 'warning',
|
|
473
652
|
detail: 'Class static members live on the class, not on individual instances.\n`toBinary` operates on instance shape, so statics are excluded.',
|
|
474
653
|
},
|
|
475
654
|
TB013: {
|
|
476
655
|
headline: "Symbol-keyed property `{0}` is silently not serialised by `toBinary` — symbol keys aren't JSON-representable.",
|
|
656
|
+
severity: 'warning',
|
|
477
657
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `toBinary` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
478
658
|
},
|
|
479
659
|
TB014: {
|
|
480
660
|
headline: "Union member(s) of type `{0}` can't be represented as data — `toBinary` drops them, so the union is serialised as its remaining members.",
|
|
661
|
+
severity: 'warning',
|
|
481
662
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `toBinary` serialised only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `toBinary` throws at build time instead.',
|
|
482
663
|
},
|
|
483
664
|
TB015: {
|
|
484
665
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `toBinary` drops it, so this property is silently not serialised.',
|
|
666
|
+
severity: 'warning',
|
|
485
667
|
detail: '`toBinary` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `toBinary` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
486
668
|
},
|
|
487
669
|
TMP001: {
|
|
488
670
|
headline: "Temporal type `{0}` resolved to `any` — the Temporal lib isn't in your tsconfig `lib`, so the generated validator would accept any value.",
|
|
671
|
+
severity: 'error',
|
|
489
672
|
detail: 'ts-runtypes reads types through TypeScript\'s lib definitions, so it\ncan only validate `Temporal.*` types when the Temporal namespace is loaded.\nWith the lib missing, `{0}` silently degrades to `any` and the validator\nbecomes a no-op that accepts everything — almost never what you intended.\n\nFix — add "ESNext.Temporal" to your tsconfig:\n {\n "compilerOptions": {\n "lib": ["ES2023", "ESNext.Temporal"]\n }\n }',
|
|
490
673
|
},
|
|
491
674
|
UKE010: {
|
|
492
675
|
headline: 'Property `{0}` is a function — `unknownKeyErrors` does not handle function values, so this property is silently not checked.',
|
|
676
|
+
severity: 'warning',
|
|
493
677
|
detail: '`unknownKeyErrors` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
494
678
|
},
|
|
495
679
|
UKU010: {
|
|
496
680
|
headline: 'Property `{0}` is a function — `unknownKeysToUndefined` does not handle function values, so this property is silently not cleared.',
|
|
681
|
+
severity: 'warning',
|
|
497
682
|
detail: '`unknownKeysToUndefined` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
498
683
|
},
|
|
499
684
|
UKW010: {
|
|
500
685
|
headline: 'Property `{0}` is a function — `unknownKeysToUndefinedWire` does not handle function values, so this property is silently not cleared.',
|
|
686
|
+
severity: 'warning',
|
|
501
687
|
detail: '`unknownKeysToUndefinedWire` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
502
688
|
},
|
|
503
689
|
VE001: {
|
|
504
|
-
headline: '
|
|
690
|
+
headline: 'Type `{0}` can never be validated — the generated function will always fail.',
|
|
691
|
+
severity: 'error',
|
|
505
692
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
506
693
|
},
|
|
507
694
|
VE002: {
|
|
508
|
-
headline: '
|
|
695
|
+
headline: 'Type `{0}` can never be validated — the generated function will always fail.',
|
|
696
|
+
severity: 'error',
|
|
509
697
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
510
698
|
},
|
|
511
699
|
VE010: {
|
|
512
700
|
headline: 'Property `{0}` is a function — `validationErrors` does not handle function values, so this property is silently not checked.',
|
|
701
|
+
severity: 'warning',
|
|
513
702
|
detail: '`validationErrors` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
514
703
|
},
|
|
515
704
|
VE011: {
|
|
516
705
|
headline: "Method `{0}` is silently not checked by `validationErrors` — methods aren't data.",
|
|
706
|
+
severity: 'warning',
|
|
517
707
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`validationErrors` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
518
708
|
},
|
|
519
709
|
VE012: {
|
|
520
710
|
headline: "Static member `{0}` is silently not checked by `validationErrors` — statics aren't part of instance data.",
|
|
711
|
+
severity: 'warning',
|
|
521
712
|
detail: 'Class static members live on the class, not on individual instances.\n`validationErrors` operates on instance shape, so statics are excluded.',
|
|
522
713
|
},
|
|
523
714
|
VE013: {
|
|
524
715
|
headline: "Symbol-keyed property `{0}` is silently not checked by `validationErrors` — symbol keys aren't JSON-representable.",
|
|
716
|
+
severity: 'warning',
|
|
525
717
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `validationErrors` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
526
718
|
},
|
|
527
719
|
VE015: {
|
|
528
720
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `validationErrors` drops it, so this property is silently not checked.',
|
|
721
|
+
severity: 'warning',
|
|
529
722
|
detail: '`validationErrors` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `validationErrors` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
530
723
|
},
|
|
531
724
|
VE020: {
|
|
532
725
|
headline: '`validationErrors` on `any` / `unknown` always returns an empty error array — nothing is checked.',
|
|
533
|
-
|
|
726
|
+
severity: 'warning',
|
|
727
|
+
detail: 'Same reason as VL021: `any` and `unknown` describe "anything", so the\nchecker has no structure to compare against. The returned error array\nwill always be empty.\n\nFix — narrow the type to the actual shape you expect:\n - const errors = createGetValidationErrorsFn<unknown>()(value);\n+ const errors = createGetValidationErrorsFn<User>()(value);',
|
|
534
728
|
},
|
|
535
729
|
VL001: {
|
|
536
|
-
headline: '
|
|
730
|
+
headline: 'Type `{0}` can never be validated — the generated function will always fail.',
|
|
731
|
+
severity: 'error',
|
|
537
732
|
detail: "Built-in classes like `Map`, `Set`, `WeakMap`, `WeakSet`, `Int8Array`,\n`Uint8Array`, `Buffer`, and `Promise` carry runtime state that doesn't\nsurvive a JSON or binary round-trip. Their instance identity is lost the\nmoment they're serialised.\n\nFix — convert to a plain object/array before serialising:\n // for Map<K, V>:\n const data = Object.fromEntries(yourMap);\n // for Set<T>:\n const data = [...yourSet];\n // for typed arrays:\n const data = Array.from(yourBuffer);\n\nFix — change the field type to a serialisable shape:\n interface User {\n- tags: Set<string>;\n+ tags: string[];\n }",
|
|
538
733
|
},
|
|
539
734
|
VL002: {
|
|
540
|
-
headline: '
|
|
735
|
+
headline: 'Type `{0}` can never be validated — the generated function will always fail.',
|
|
736
|
+
severity: 'error',
|
|
541
737
|
detail: "Every `symbol` value carries a unique runtime identity (`Symbol() !==\nSymbol()` even with the same description). That identity disappears the\nmoment it's serialised, and two symbols can't be compared across realms,\nworkers, or process boundaries. A validator that asserts \"this is a\nsymbol\" gives a false sense of safety — the value can't actually\nround-trip.\n\nFix — use a stable string key (often a literal union):\n - type Status = symbol;\n+ type Status = 'pending' | 'active' | 'done';",
|
|
542
738
|
},
|
|
543
739
|
VL010: {
|
|
544
740
|
headline: 'Property `{0}` is a function — `validate` does not handle function values, so this property is silently not validated.',
|
|
741
|
+
severity: 'warning',
|
|
545
742
|
detail: '`validate` works on JSON-shaped data; functions don\'t survive JSON, so\nthe emitter drops them. The rest of the object\'s behaviour is unaffected.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If you need a stricter checker that fails on\nmissing/extra function-typed members, watch the project roadmap.',
|
|
546
743
|
},
|
|
547
744
|
VL011: {
|
|
548
745
|
headline: "Method `{0}` is silently not validated by `validate` — methods aren't data.",
|
|
746
|
+
severity: 'warning',
|
|
549
747
|
detail: "Class and object methods aren't part of the serialisable shape, so\n`validate` excludes them. The rest of the type still works.\n\nIf you wanted the method's return value validated/serialised, expose it\nas a data property instead.",
|
|
550
748
|
},
|
|
551
749
|
VL012: {
|
|
552
750
|
headline: "Static member `{0}` is silently not validated by `validate` — statics aren't part of instance data.",
|
|
751
|
+
severity: 'warning',
|
|
553
752
|
detail: 'Class static members live on the class, not on individual instances.\n`validate` operates on instance shape, so statics are excluded.',
|
|
554
753
|
},
|
|
555
754
|
VL013: {
|
|
556
755
|
headline: "Symbol-keyed property `{0}` is silently not validated by `validate` — symbol keys aren't JSON-representable.",
|
|
756
|
+
severity: 'warning',
|
|
557
757
|
detail: "JSON only supports string keys; symbol-keyed properties are dropped\nfrom the serialised form. `validate` follows the same rule.\n\nFix — use a string key:\n - [Symbol.for('id')]: string;\n+ id: string;",
|
|
558
758
|
},
|
|
559
759
|
VL014: {
|
|
560
760
|
headline: "Union member(s) of type `{0}` can't be represented as data — `validate` drops them, so the union is validated as its remaining members.",
|
|
761
|
+
severity: 'warning',
|
|
561
762
|
detail: 'A union projects to its serialisable members only: `DataOnly<Date | symbol>`\nis `Date`. The dropped member(s) ({0}) carry no JSON-shaped value (symbol,\nfunction, Promise, or a non-serialisable built-in like `Map` / `Set` /\ntyped arrays), so `validate` validated only the members that remain.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md. If EVERY member of the union is non-serialisable the\nprojection is `never`, and `validate` throws at build time instead.',
|
|
562
763
|
},
|
|
563
764
|
VL015: {
|
|
564
765
|
headline: 'Property `{0}` has a non-serialisable value type (symbol, Promise, or a non-serialisable built-in) — `validate` drops it, so this property is silently not validated.',
|
|
766
|
+
severity: 'warning',
|
|
565
767
|
detail: '`validate` works on JSON-shaped data. A property whose value is a symbol,\na Promise, or a non-serialisable built-in (typed array, ArrayBuffer, …) carries\nno JSON-shaped value, so it is dropped: `DataOnly<{ {0}: symbol }>` is `{}`.\nThe rest of the object\'s behaviour is unaffected.\n\nNote the difference from a property that is only STRUCTURALLY unserialisable —\n`{0}: symbol[]` or `{0}: Map<string, symbol>` — which CANNOT be safely\ndropped (DataOnly keeps it as `never[]`): there `validate` throws at build\ntime instead.\n\nThis is by design — see the "validate contract — serializable data only"\nsection in CLAUDE.md.',
|
|
566
768
|
},
|
|
567
769
|
VL021: {
|
|
568
770
|
headline: '`validate` on `any` / `unknown` always returns true — the validator accepts every value.',
|
|
569
|
-
|
|
771
|
+
severity: 'warning',
|
|
772
|
+
detail: '`any` and `unknown` describe "anything", so a structural validator has\nnothing to check. The resulting function passes for every input —\nincluding the ones you probably wanted to reject.\n\nFix — narrow the type to the actual shape you expect:\n - const isUser = createValidateFn<unknown>();\n+ const isUser = createValidateFn<User>();',
|
|
570
773
|
},
|
|
571
774
|
};
|
|
572
775
|
//# sourceMappingURL=diagnosticCatalog.generated.js.map
|