mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
25 lines
468 B
Plaintext
25 lines
468 B
Plaintext
//// [tests/cases/compiler/checkJsObjectLiteralHasCheckedKeyof.ts] ////
|
|
|
|
=== file.js ===
|
|
// @ts-check
|
|
const obj = {
|
|
>obj : Symbol(obj, Decl(file.js, 1, 5))
|
|
|
|
x: 1,
|
|
>x : Symbol(x, Decl(file.js, 1, 13))
|
|
|
|
y: 2
|
|
>y : Symbol(y, Decl(file.js, 2, 9))
|
|
|
|
};
|
|
|
|
/**
|
|
* @type {keyof typeof obj}
|
|
*/
|
|
let selected = "x";
|
|
>selected : Symbol(selected, Decl(file.js, 9, 3))
|
|
|
|
selected = "z"; // should fail
|
|
>selected : Symbol(selected, Decl(file.js, 9, 3))
|
|
|