Commit Graph

559 Commits

Author SHA1 Message Date
Nathan Shively-Sanders
32054f1c31 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 14:07:48 -07:00
Sheetal Nandi
027d65a920 Fix map constructor to accept readonly tuple
Fixes #29721
2019-03-13 14:52:58 -07:00
Kagami Sascha Rosylight
13c72b786e Merge remote-tracking branch 'upstream/master' into es2019 2019-02-08 06:55:56 +09:00
Kagami Sascha Rosylight
b3c179540a String.prototype.{trimStart,trimEnd} hit stage 4 2019-02-08 00:51:23 +09:00
Kagami Sascha Rosylight
f525a89e87 Array.prototype.{flat,flatMap} hit stage 4 2019-02-08 00:10:34 +09:00
Kagami Sascha Rosylight
a8823f5169 Merge branch 'master' into es2019 2019-02-07 10:08:26 +09:00
Kagami Sascha Rosylight
2c4589d5a9 Merge remote-tracking branch 'upstream/master' into async-es2018 2019-02-07 09:51:26 +09:00
Nathan Shively-Sanders
2f9218f346 DOM update February 2019 (#29690)
* DOM update February 2019

* Update some baselines

* Update mappedTypeRecursiveInference baselines
2019-02-04 15:25:41 -08:00
Ryan Cavanaugh
4ff71ecb98 Merge pull request #29696 from Microsoft/filter-unknown
Use unknown for array predicates' return types
2019-02-04 13:26:29 -08:00
Anders Hejlsberg
f86b635122 Merge pull request #29705 from Microsoft/fixParametersAndReturnType
Less restrictive Parameters<T> and ReturnType<T>
2019-02-04 12:08:29 -08:00
Ryan Cavanaugh
0a041ee536 Merge pull request #28270 from AnyhowStep/json-parse-reviver-stringify-replacer-better-declaration
JSON.parse(), JSON.stringify() more specific declarations for #6955
2019-02-02 12:10:56 -08:00
Anders Hejlsberg
e7ad76ddc8 Less restrictive constraints in Parameters and ReturnType types 2019-02-02 09:28:21 -08:00
Ryan Cavanaugh
efbe630a13 Use unknown for array predicates' return types 2019-02-01 17:05:04 -08:00
Ryan Cavanaugh
caa8dc25a8 Merge pull request #29115 from KromDaniel/patch-1
Duplicate `wait` instead of `wait` and `notify` at `es2017.sharedmemory.d.ts`
2019-01-30 19:12:46 -08:00
Ryan Cavanaugh
c779fc7998 Merge pull request #28034 from disisisid/master
Typo fix in src/lib/README.md
2019-01-24 14:45:31 -08:00
Ryan Cavanaugh
d85c4e551e Merge pull request #27121 from xl1/26977-typedarray
Allow non-number source for TypedArray.from
2019-01-24 13:42:43 -08:00
Kagami Sascha Rosylight
1d8a2ea38c Symbol.prototype.description hit stage 4 2019-01-06 11:42:55 +09:00
Kagami Sascha Rosylight
60996b5bed Merge remote-tracking branch 'upstream/master' into async-es2018 2018-12-26 17:15:03 +09:00
Daniel Krom
490f69f984 duplicate wait instead of wait and notify
original was
```
notify(typedArray: Int32Array, index: number, count: number): number;
```
it seems to be a mistake, the real method is `notify` (the first wait is fine)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/notify
2018-12-21 10:41:24 +02:00
Anders Hejlsberg
9cc997fca7 Improve typing of 'bind' method on function types 2018-12-08 11:02:19 -08:00
AnyhowStep
dd3ed02868 Removed stray whitespace 2018-11-13 12:24:03 -05:00
Kagami Sascha Rosylight
7017d1a9ef Merge branch 'master' into async-es2018 2018-11-12 11:04:21 +09:00
Daniel Rosenwasser
b48c2b295d Merge pull request #24396 from falsandtru/lib/Symbol.toStringTag
Don't constrain string tag values
2018-11-09 12:29:46 -08:00
Daniel Rosenwasser
0010a38660 Merge pull request #28343 from Microsoft/lib/update-nov-2018
Lib update Nov 2018
2018-11-09 12:06:41 -08:00
Caleb Sander
0c1bf316a2 Declaration files for BigInt 2018-11-05 11:36:30 -08:00
Nathan Shively-Sanders
b830ef8214 Nov 2018 DOM update 2018-11-05 10:19:05 -08:00
AnyhowStep
01e71820fc Fixes Microsoft/TypeScript#6955 2018-10-31 17:00:24 -04:00
Nathan Shively-Sanders
996fb78445 Test update of DOM. (#28050)
Based on the few changes that have been accepted since Mohamed left.
2018-10-23 15:24:56 -07:00
Andy
afa94c527c Un-consolidate overloads for Map and WeakMap (#28052) 2018-10-22 11:18:56 -07:00
Siddharth Singh
39e533a97e Typo fix
Changed "mean" to "meant"
2018-10-22 03:33:11 +05:30
Basarat Ali Syed
c86b9ca660 📝 Better description of Pick mapped type
closes https://github.com/Microsoft/TypeScript/issues/25976
2018-10-03 10:57:43 +10:00
Anders Hejlsberg
5510e0755e Merge branch 'master' into typedBindCallApply
# Conflicts:
#	tests/baselines/reference/tsxTypeArgumentPartialDefinitionStillErrors.errors.txt
#	tests/baselines/reference/wrappedAndRecursiveConstraints4.errors.txt
2018-09-24 16:38:39 -07:00
xl1
9819b6b7aa Allow non-number array for source of TypedArray.from 2018-09-15 23:00:01 +09:00
Dan Rollo
2b0e9e686b typo: missing word: "to" (#27079)
Change:
...a resolve callback used resolve the promise...
to: 
...a resolve callback used to resolve the promise...

This PR suggested from: https://github.com/Microsoft/TypeScript/pull/27075
2018-09-13 14:23:56 -07:00
Anders Hejlsberg
df1e33a8a5 Add 'bind' overloads for rest parameter arrays 2018-09-12 13:17:11 -07:00
Anders Hejlsberg
a5dece30d9 Update declarations 2018-09-11 06:14:41 -07:00
Anders Hejlsberg
55b6513078 New CallableFunction and NewableFunction types in es5.d.ts 2018-09-10 15:12:42 -07:00
Kagami Sascha Rosylight
26d6d7d16e Merge remote-tracking branch 'upstream/master' into async-es2018 2018-09-06 09:55:41 +09:00
Ryan Cavanaugh
c188864394 Merge pull request #26112 from rhys-vdw/22685-array-flat-fix
Fix issue with Array#flatMap callback return type
2018-09-05 11:55:42 -07:00
Nathan Shively-Sanders
c929e74310 Add [Constructor]Parameter types to lib.d.ts (#26243) 2018-08-31 07:46:16 -07:00
Kagami Sascha Rosylight
76ae12d143 Change esnext.asynciterable to es2018.asynciterable 2018-08-06 16:30:08 +09:00
Mohamed Hegazy
5fbc7d92c2 Port generated lib files 2018-08-02 14:44:17 -07:00
Mohamed Hegazy
150fd90db9 Port generated lib files 2018-08-02 10:04:57 -07:00
Rhys van der Waerden
23640d971b Fix issue with Array#flatMap callback return type
Closes #22685
2018-08-01 17:36:21 +10:00
Mohamed Hegazy
5a8804fcd7 Merge remote-tracking branch 'origin/master' into portLibFiles731 2018-07-31 15:07:25 -07:00
Mohamed Hegazy
aa632582a3 Port generated lib files 2018-07-31 14:00:25 -07:00
Mohamed Hegazy
fe32602df6 Port generated lib files 2018-07-31 12:47:37 -07:00
Mohamed Hegazy
ff69f7f744 Port generated lib files 2018-07-31 12:20:35 -07:00
Mohamed Hegazy
7799ae18b4 Port generated lib files 2018-07-25 15:32:42 -07:00
Daniel Rosenwasser
b8ca925de0 Place 'pop' first in 'Array'. 2018-07-10 19:34:19 -07:00