value to Type converts a value from one type to another, but only for conversions that have a clear meaning. Turf found one that doesn’t, and names both types.
These are fine:
Example
mut d: double = 5 to double; // a whole number to a decimalmut n: int = 3.9 to int; // a decimal to a whole number (drops the .9)mut s: string = 42 to string; // a number to textmut c: char = 65 to char; // a character code to a charactermut code: int = 'a' to int; // and backmut p: Point = r to Point; // copies the Point a `&Point` refers toThese are not:
Example
mut b: bool = 5 to bool; // there is no "5 as true/false"mut n: int = true to int; // a bool is not secretly 0 or 1Say what you mean instead. If you want to know whether a number is zero, compare it: n != 0. If you want a number from a condition, choose the numbers: give 1 otherwise 0.
Run turf --explain E134 in a terminal to read this again.