Skip to content

Diagnostics ​

Every diagnostic the compiler can emit, in one place. Errors block typeflow check (non-zero exit); warnings don't, but deserve attention. Codes are stable — safe to grep for, safe to link to.

Every example below is live (edit it!) and verified at build time: the docs build compiles each one and fails if it stops reproducing its code.

CodeSeverityMeaning
TF1001errorLexical error
TF1002errorParse error
TF2001errorUnknown identifier
TF2002errorUnknown property
TF2003errorUnsafe access through an optional value
TF2004errorOperator / type mismatch
TF2005errorFilter or index on a non-array
TF2006errorInvalid property access or projection target
TF2007errorUnknown function
TF2008errorWrong function arguments
TF2009errorNon-boolean filter predicate
TF2010errorInput type could not be resolved
TF2011errorInvalid sort key
TF2012errorProperty access on 'unknown'
TF2013warningUseless '??' (never nullish)
TF2014errorDuplicate property
TF2015warningNo 'input' declaration
TF2016errorFunction name conflict
TF2017error'fn' return type mismatch
TF2018errorDuplicate binding
TF2367warningComparison without overlap

TF1001 — Lexical error error ​

The source contains text the lexer cannot turn into tokens — most commonly an unterminated string or a character that is not part of the language.

How to fix — Close the string (or remove the stray character). The caret points at the exact offset.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred typeunknown
  • 4:13errorTF1001Unterminated string literal.

TF1002 — Parse error error ​

The tokens do not form a valid mapping — a missing :, an unclosed {, a misplaced comma. Parsing stops at the first structural error, so fix it and re-check: later errors may disappear.

How to fix — The message says what the parser expected at that position.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred typeunknown
  • 4:8errorTF1002Expected ':'.

TF2001 — Unknown identifier error ​

A bare name does not resolve to anything in scope: not the input binding, not a projection element field, not a function parameter. Typeflow suggests the closest visible name.

How to fix — Check the spelling against the input declaration (or the enclosing projection).

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ name: any }
  • 4:9errorTF2001Cannot find name 'usr'. Did you mean 'user'?

TF2002 — Unknown property error ​

The flagship check: a path segment does not exist on the type it is read from. In plain code this typo would be a silent undefined in production — here it is a compile error with a "did you mean" suggestion.

How to fix — Fix the spelling, or update the input type if the data really has that field.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ mail: any }
  • 4:14errorTF2002Property 'emial' does not exist on type '{ email: string; firstName: string }'. Did you mean 'email'?

TF2003 — Unsafe access through an optional value error ​

A path reads through a segment that may be undefined or null (declared ?: or nullable) using plain .. The same rule protects -> projections and [...] filters/indexing on possibly-nullish targets.

How to fix — Use the optional access operator (?.), or provide a default first with ??. A ?? default also removes the optionality from the inferred output type.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ email: string }
  • 4:23errorTF2003Object is possibly 'undefined'.
    hint: Use the optional access operator: '?.email', or provide a default with '??'.

TF2004 — Operator / type mismatch error ​

An operator received operands it does not accept: + on a string and a number (Typeflow never coerces), arithmetic on non-numbers, !/&&/|| on non-booleans, a non-boolean ? : condition, ordering comparisons between mixed types.

How to fix — Convert explicitly — string(user.age), number(raw) — so the intent is visible in the mapping.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ label: any }
  • 4:10errorTF2004Operator '+' cannot be applied to types 'string' and 'number'.
    hint: Typeflow does not coerce types: '+' expects two strings or two numbers.

TF2005 — Filter or index on a non-array error ​

The [...] operator (filtering with a predicate, or indexing with a number) was applied to something that is not an array.

How to fix — Check the path — the segment before [ must be an array of the input type.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ first: any }
  • 4:10errorTF2005Filtering or indexing requires an array type, got 'string'.

TF2006 — Invalid property access or projection target error ​

A property was read on a scalar (number, string, boolean), or a -> projection was applied to something that is not an object or an array of objects.

How to fix — Follow the inferred type of the left-hand side — the message shows exactly what type the access was attempted on.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ city: any }
  • 4:18errorTF2006Cannot access property 'city' on type 'number'.

TF2007 — Unknown function error ​

A call names a function that is neither a builtin, an fn definition, a use declaration, nor a registered defineFunction. The hint lists everything that is available.

How to fix — Pick from the hint list, or declare the function (fn, use, or defineFunction).

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ name: any }
  • 4:9errorTF2007Unknown function 'capitalizeWords'.
    hint: Available functions: string, length, contains, matches, upper, lower, trim, pad, substring, split, replace, base64encode, base64decode, encodeUrl, decodeUrl, encodeUrlComponent, decodeUrlComponent, number, formatBase, floor, ceil, round, abs, power, sqrt, random, sum, max, min, average, boolean, not, exists, count, join, append, zip, sort, reverse, shuffle, distinct, keys, values, lookup, merge, spread, type, now, millis, fromMillis, toMillis.

TF2008 — Wrong function arguments error ​

A function was called with the wrong number of arguments, or an argument whose type does not match the parameter. The hint restates the full signature. Applies to builtins and to your own fn / use / defineFunction functions alike.

How to fix — Match the signature — convert arguments explicitly when needed (upper(string(user.age))).

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ shout: string }
  • 4:16errorTF2008Argument of type 'number' is not assignable to parameter of type 'string'.
    hint: upper(value: string): string

TF2009 — Non-boolean filter predicate error ​

The expression inside a [...] filter must be a boolean. Bare identifiers inside a filter resolve on the element, so labels[active] works when active is a boolean field — but labels[name] is a string, not a predicate.

How to fix — Write a real condition: labels[name == "core"].

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ named: { name: string; active: boolean }[] }
  • 4:22errorTF2009A filter predicate must be of type 'boolean', got 'string'.

TF2010 — Input type could not be resolved error ​

An input x: T from "./module" declaration could not be resolved: no schema adapter is configured, the module does not exist, or it does not export that type. (The playground cannot import files — this example shows the diagnostic itself; in a project the TypeScript adapter resolves the type through the compiler API.)

How to fix — Check the module path and the exported type name — or use an inline structural type.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ id: any }
  • 1:1errorTF2010Cannot resolve type 'ApiUser' from './user-types': no schema adapter is configured.

TF2011 — Invalid sort key error ​

A ^(...) sort key must evaluate to a number or a string — booleans, objects and arrays have no meaningful order. Nullish keys are fine: the runtime sorts them last.

How to fix — Sort on a scalar field, or derive one — ^(length(name)).

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ sorted: string[] }
  • 4:24errorTF2011A sort key must be of type 'number' or 'string', got 'boolean'.

TF2012 — Property access on 'unknown' error ​

A value typed unknown cannot be dereferenced — unlike any, unknown means "I promise nothing about this shape", and Typeflow holds you to it.

How to fix — Narrow the type in the input declaration, or pass the value through as-is.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ name: any }
  • 4:19errorTF2012Property 'name' does not exist on type 'unknown'.

TF2013 — Useless '??' (never nullish) warning ​

The left side of ?? can never be null or undefined, so the fallback is dead code. Often a leftover after an input type gained a required field — the compiler flags it so mappings don't accumulate cruft.

How to fix — Remove the ?? default, or make the input field optional if it really can be absent.

Mapping✔Playground ↗
Input JSON
Output
{
  "name": "Ada"
}
inferred type{ name: string }
  • 4:9warningTF2013The left side of '??' has type 'string', which is never null or undefined.

TF2014 — Duplicate property error ​

The same key appears twice in an object body. JSON would silently keep the last one — Typeflow refuses the ambiguity.

How to fix — Remove or rename one of the two.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ name: string }
  • 5:3errorTF2014Duplicate property 'name'.

TF2015 — No 'input' declaration warning ​

Without an input declaration the input is typed any: the mapping still runs, but paths cannot be validated — you lose the entire point of the language.

How to fix — Bind the input: input user: T from "./module", or an inline structural type.

Mapping✔Playground ↗
Input JSON
Output
{
  "answer": 42
}
inferred type{ answer: 42 }
  • 1:5warningTF2015No 'input' declaration: the input is typed as 'any' and paths cannot be validated.
    hint: Declare one, e.g.: input user: User from "./types"

TF2016 — Function name conflict error ​

An fn definition, use declaration, or registered function has the same name as a builtin or another function. One name, one meaning — shadowing builtins would make mappings mean different things in different projects.

How to fix — Rename your function.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ name: string }
  • 3:4errorTF2016Function 'upper' conflicts with a built-in function.

TF2017 — 'fn' return type mismatch error ​

An fn declares a return type, but its body evaluates to something not assignable to it. The declared type is a contract — the body must satisfy it.

How to fix — Fix the body, or fix (or drop) the declared return type — it is optional and inferred from the body.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ label: string }
  • 3:22errorTF2017Function 'label' returns 'number', which is not assignable to the declared type 'string'.

TF2018 — Duplicate binding error ​

Two let bindings in the same object block share a name. A binding sees only the bindings declared before it, so redefining a name in the same block is ambiguous — Typeflow refuses it.

How to fix — Rename one of the bindings.

Mapping✖ 1Playground ↗
Input JSON
Output
// Fix the mapping errors to see the output.
inferred type{ name: string }
  • 5:7errorTF2018Duplicate binding 'full'.

TF2367 — Comparison without overlap warning ​

The two sides of a comparison have types that can never be equal — a number compared against a string, for instance. The comparison is legal but always false, which is almost always a bug: Typeflow never coerces, so age == "36" does not do what it would in JavaScript. (Same number as TypeScript's TS2367, on purpose.)

How to fix — Compare against the right type — user.age == 36 — or convert explicitly with string() / number().

Mapping✔Playground ↗
Input JSON
Output
{
  "isAdult": false
}
inferred type{ isAdult: boolean }
  • 4:12warningTF2367This comparison appears to be unintentional because the types 'number' and '"18"' have no overlap.

Released under the MIT License.