mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
//// [tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts] ////
|
|
|
|
//// [globalThisBlockscopedProperties.ts]
|
|
var x = 1
|
|
const y = 2
|
|
let z = 3
|
|
globalThis.x // ok
|
|
globalThis.y // should error, no property 'y'
|
|
globalThis.z // should error, no property 'z'
|
|
globalThis['x'] // ok
|
|
globalThis['y'] // should error, no property 'y'
|
|
globalThis['z'] // should error, no property 'z'
|
|
globalThis.Float64Array // ok
|
|
globalThis.Infinity // ok
|
|
|
|
declare let test1: (typeof globalThis)['x'] // ok
|
|
declare let test2: (typeof globalThis)['y'] // error
|
|
declare let test3: (typeof globalThis)['z'] // error
|
|
declare let themAll: keyof typeof globalThis
|
|
|
|
|
|
//// [globalThisBlockscopedProperties.js]
|
|
"use strict";
|
|
var x = 1;
|
|
const y = 2;
|
|
let z = 3;
|
|
globalThis.x; // ok
|
|
globalThis.y; // should error, no property 'y'
|
|
globalThis.z; // should error, no property 'z'
|
|
globalThis['x']; // ok
|
|
globalThis['y']; // should error, no property 'y'
|
|
globalThis['z']; // should error, no property 'z'
|
|
globalThis.Float64Array; // ok
|
|
globalThis.Infinity; // ok
|