mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
25 lines
492 B
TypeScript
25 lines
492 B
TypeScript
//// [tests/cases/compiler/discriminatedUnionErrorMessage.ts] ////
|
|
|
|
//// [discriminatedUnionErrorMessage.ts]
|
|
type Square = { kind: "sq", size: number }
|
|
type Rectangle = { kind: "rt", x: number, y: number }
|
|
type Circle = { kind: "cr", radius: number }
|
|
type Shape =
|
|
| Square
|
|
| Rectangle
|
|
| Circle;
|
|
let shape: Shape = {
|
|
kind: "sq",
|
|
x: 12,
|
|
y: 13,
|
|
}
|
|
|
|
|
|
//// [discriminatedUnionErrorMessage.js]
|
|
"use strict";
|
|
let shape = {
|
|
kind: "sq",
|
|
x: 12,
|
|
y: 13,
|
|
};
|