Language
val
Prevent mutation through a binding or parameter without changing runtime values.
example.tt
val const config = loadConfig();
config.retries = 3; // compile error
function inspect(val user: User) {
return user.name;
}Features
- Rejects property, index, increment, delete, and compound mutations at any depth.
- val let may still be rebound to another value.
- The modifier is erased and adds no runtime wrapper or readonly type.