mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
18 lines
393 B
Plaintext
18 lines
393 B
Plaintext
file.js(11,1): error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
|
|
|
|
|
|
==== file.js (1 errors) ====
|
|
// @ts-check
|
|
const obj = {
|
|
x: 1,
|
|
y: 2
|
|
};
|
|
|
|
/**
|
|
* @type {keyof typeof obj}
|
|
*/
|
|
let selected = "x";
|
|
selected = "z"; // should fail
|
|
~~~~~~~~
|
|
!!! error TS2322: Type '"z"' is not assignable to type '"x" | "y"'.
|
|
|