Functionutilsv0.10.0
Throws:
A SeedcordTypeError whenever it runs. Only a value that the types ruled out can reach it.
type Shape = { kind: 'circle' } | { kind: 'square' };
function area(shape: Shape): number {
switch (shape.kind) {
case 'circle': return Math.PI;
case 'square': return 1;
default: return assertNever(shape); // compile error if a Shape variant is added
}
}value
value: never