KScript docs
EN

Error codes

KS5020

In a strict file, a value whose type the checker can't prove. Write the type where the value is declared. In a strict file it is an error, and the script doesn't run until it is fixed:

<strict />

<let name="names" value="[]" /> <!-- error: write the item type, such as $names: string[] = [] -->
<let name="found" value="null" /> <!-- error: write its type: $found: string? = null -->
<let name="data" type="any" value="'{&quot;n&quot;: 1}'->convert(from: json)" />
<let name="n" value="$data.n" /> <!-- error: the checker can't tell what $n holds; write $n: int = $data.n -->
strict

$names = []                   // error: write the item type, such as $names: string[] = []
$found = null                 // error: write its type: $found: string? = null
$data: any = '{"n": 1}'->convert(from: json)
$n = $data.n                  // error: the checker can't tell what $n holds; write $n: int = $data.n

The same code reports a variable given values of different types, a lambda parameter with nothing to take a type from (write fn(n: number) => ...), a function whose result can't be worked out (write fn first(items: list): string) and a field with no type and no default.