2015-03-02 23:41:44 +01:00
|
|
|
/// <reference path="fourslash.ts" />
|
|
|
|
|
|
|
|
//// /*1*/15 / /*2*/Math.min(61 / /*3*/42, 32 / 15) / /*4*/15;
|
|
|
|
|
|
|
|
goTo.marker("1");
|
|
|
|
verify.not.quickInfoExists();
|
|
|
|
|
|
|
|
goTo.marker("2");
|
Forbid accessing block-scoped variables on globalThis (#30510)
* Forbid accessing const & let on globalThis
It's just an error; you still get the type of the property.
* Disallow access of blockscoped vars on globalThis
Also change Array, Function, String, et al from `const` to `var` so that
they remain accessible via `globalThis.String`.
* Update baselines after lib.d.ts change
Note especially the change in redefineArray, which is now allowed as
long as you provide a type that is assignable to ArrayConstructor.
* Remove blockscoped vars from typeof globalThis
Unlike forbidding them, this removes the properties entirely.
Unfortunately, this means that accessing these properties is only an
error with noImplicitAny, and that error is quite confusing.
Let's discuss our options. I see 3:
1. Forbid access of block-scoped vars as properties (in all flag
settings), but leave them on the type. Simple to implement.
2. Remove block-scoped vars from the globalThis type. Has the bad
error/flag behaviour described above, but simple to implement.
3. Remove block-scoped vars from the globalThis type. Also, forbid
accessing them by executing another resolveName lookup for failed
property accesses on globalThisSymbol. If the second lookup returns a
blockscoped var, issue an error instead of falling back to the index
signature. This seems too complex to me.
* Update baselines
* Better error for block-scoped usage on globalThis
So that value-space references have as clear an error as type-space
references.
* Update fourslash tests
* Fix semi-colon lint
* Don't copy so much when filtering blockscoped vars
2019-03-25 22:07:48 +01:00
|
|
|
verify.quickInfoIs("var Math: Math",
|
2018-07-28 01:28:49 +02:00
|
|
|
"An intrinsic object that provides basic mathematics functionality and constants.");
|
2015-03-02 23:41:44 +01:00
|
|
|
|
|
|
|
goTo.marker("3");
|
|
|
|
verify.not.quickInfoExists();
|
|
|
|
|
|
|
|
goTo.marker("4");
|
Forbid accessing block-scoped variables on globalThis (#30510)
* Forbid accessing const & let on globalThis
It's just an error; you still get the type of the property.
* Disallow access of blockscoped vars on globalThis
Also change Array, Function, String, et al from `const` to `var` so that
they remain accessible via `globalThis.String`.
* Update baselines after lib.d.ts change
Note especially the change in redefineArray, which is now allowed as
long as you provide a type that is assignable to ArrayConstructor.
* Remove blockscoped vars from typeof globalThis
Unlike forbidding them, this removes the properties entirely.
Unfortunately, this means that accessing these properties is only an
error with noImplicitAny, and that error is quite confusing.
Let's discuss our options. I see 3:
1. Forbid access of block-scoped vars as properties (in all flag
settings), but leave them on the type. Simple to implement.
2. Remove block-scoped vars from the globalThis type. Has the bad
error/flag behaviour described above, but simple to implement.
3. Remove block-scoped vars from the globalThis type. Also, forbid
accessing them by executing another resolveName lookup for failed
property accesses on globalThisSymbol. If the second lookup returns a
blockscoped var, issue an error instead of falling back to the index
signature. This seems too complex to me.
* Update baselines
* Better error for block-scoped usage on globalThis
So that value-space references have as clear an error as type-space
references.
* Update fourslash tests
* Fix semi-colon lint
* Don't copy so much when filtering blockscoped vars
2019-03-25 22:07:48 +01:00
|
|
|
verify.not.quickInfoExists();
|