Open kevinbarabash opened 3 months ago
We want to avoid be able to mutate values that are supposed to be immutable. For instance, the following should not be allowed:
type Point = {x: number, y: number}; type Shape = {kind: "Polygon", points: Point[]} | {kind: "Circle", radius: number, center: Point}; declare let shape: Shape; match shape { {kind: "Polygon", mut points} => points.push({x: 5, y: 10}, {kind: "Circle", mut center} { center.x = 0; center.y = 0; } }
We want to avoid be able to mutate values that are supposed to be immutable. For instance, the following should not be allowed: