mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
19 lines
651 B
Plaintext
19 lines
651 B
Plaintext
discriminatedUnionErrorMessage.ts(10,5): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Square'.
|
|
|
|
|
|
==== discriminatedUnionErrorMessage.ts (1 errors) ====
|
|
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,
|
|
~
|
|
!!! error TS2353: Object literal may only specify known properties, and 'x' does not exist in type 'Square'.
|
|
y: 13,
|
|
}
|
|
|