Error Reference Hub
NV1003Compiler
Type Mismatch
An expression evaluates to a type incompatible with the expected destination type or operator operand requirements.
Why this error occurs
Occurs when assigning a value of one type to a variable explicitly annotated with a different type, returning the wrong type from a typed function, or performing arithmetic across incompatible types without explicit conversion.
Incorrect Code
// incorrect: assigning string to int, or concatenating string with integer without conversion
let count: int = "twenty"
let message = "Total: " + 100Corrected Code
// corrected: use explicit type conversion functions
let count: int = 20
let message = "Total: " + str(100)
print(message)Troubleshooting & Remediation
- 1Use 'str(val)', 'int(val)', or 'float(val)' for explicit type conversions.
- 2Verify function return type annotations match the returned expression.
- 3Inspect variable type declarations and ensure initializers match annotations.
- 4Use 'typeof(x)' during debugging to verify the runtime type of values.
Relevant CLI Commands
$ nextviper check$ nextviper check --format=json
