Appendix: Type checking errors

Type mismatches

Value is known to be not null (warning)

The value is known to be non-null here.

// Example of the warning:
// FlowScript knows that x is not equal to null.
// The warning indicates that the comparison will always be false.

let x : number? = 1;
if x == null {
    // ...
}

Value is known to be null (warning)

The value is known to be null here.

// Example of the warning:
// FlowScript knows that x is equal to null. The warning indicates
// that the comparison will always be true.

let x : number? = null;
if x == null {
    // ...
}

Missing expected field

Expected field <name> of type <type name>

Generic function must be specialized

The function is generic and the argument types cannot be inferred from usage.

default() is not supported for type variables

The default keyword cannot be used with type variables.

Function is not generic

The function is not generic and cannot accept type arguments.

Type mismatch

Expected a <A>, but the term has type <B>.

Operator type mismatch

The operator <operator> cannot be used with types <A> and <B>.

Argument type mismatch

Argument <name> was expected to have type <A>, but the expression has type <B>.

Wrong argument count

Incorrect number of arguments for function <function signature>.

Unknown member

The type does not contain a field labelled <name> and no matching self function was found.

Value is not a record

The value is not a record.

Wrong arity of type constructor

The type <name> requires <number> type arguments.

Duplicate field

The field label <label> occurs more than once.

Duplicated type argument

The function has duplicated type arguments.

Duplicated parameter name

The parameter <name> occurs more than once.

Cyclic reference in type

The type involves an immediate cyclic reference.

Multiple nullability annotations (warning)

The type is already nullable.

Type is not a record type

The type is not a record type.

Impossible type narrowing

The type narrowing expression will always be false.

Truistic type narrowing

The type narrowing expression will always be true.

Control flow errors

Identifier already declared

The identifier <name> is already declared.

Unknown variable

The variable <name> does not exist or cannot be used in this context.

Unknown type

The type <name> does not exist.

Variable is read-only

The variable <name> is read-only in this scope.

Continue only allowed in loops

The continue statement is only allowed in the body of loops.

Break only allowed in loops

The break statement is only allowed in the body of loops.

Type already declared

The type <name> is already declared.

Not all paths return a value

Not all paths return a value.

Type cannot be used with loops

The term has type <type> and cannot be used with for loops or queries.

Cannot declare type inside loop or conditional block

Types cannot be declared inside loops or conditional blocks.

Module not found

The module <name> is not declared.

Statement in module

Modules can only contain functions and type definitions.

Query errors

Ambiguous join condition

The join condition has ambiguous identifiers; use an alias to resolve.

Wildcard in joint selection

The wildcard (*) is not supported when joining two sequences. Specify the columns explicitly instead.

Wildcard in grouped selection

The wildcard (*) is not supported when grouping a sequence. Specify the columns explicitly instead.

Ambiguous reference in query

The identifier is ambiguous; use an alias to resolve.

Type is not queryable

The type <type name> cannot be used with query operators.

Missing alias

The expression contains no implicit field name. Specify one with the 'as' keyword.

Missing consition on with update

If any clause of a with-expression has a condition, all clauses must have conditions.

More than one otherwise clause

There may be at most one 'otherwise' clause.

Redundant otherwise clause (warning)

An 'otherwise' clause is only needed in conjunction with 'when' clauses.

Otherwise clause must come last

An 'otherwise' must be the last clause in a with-expression.

Last updated

Was this helpful?