Commit graph

126 commits

Author SHA1 Message Date
Michael Tamm 6bd3b21f6c fix (lib): Loosen predicate return types of typed arrays, adapt docs (#31343)
fixes #31472
2019-09-30 15:26:39 -07:00
Michal Przybys 63d940da53
Added example of sortFn 2019-09-17 16:32:15 +02:00
Michal Przybys 2c8df45aa9
Fixed typo 2019-09-12 10:17:05 +02:00
Michal Przybys 894eb59be0
Better Array.sort compareFn docs 2019-09-11 13:24:06 +02:00
Alexander T fea9e11174 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-20 11:07:18 +03:00
falsandtru 5ae286329f Update String#toLocale{Lower,Upper}Case methods (#32961) 2019-08-19 09:10:12 -07:00
Alexander T b6d981aec8 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-08-16 12:13:57 +03:00
阿卡琳 a53e4a19ef Allow to omit the begin parameter of %TypedArray%.prototype.subarray (#32125)
* Allow to omit the begin parameter of %TypedArray%.prototype.subarray

* update baselines
2019-08-15 15:58:24 -07:00
Matthew Miller c6a0739dc9 fix(docs): Fixed the docs for Array#slice not spec (#31182)
ifying that the 'end' parameter is exclusive.
2019-08-15 10:28:28 -07:00
Alexander ceccfd8867 array-type: [ default: array, generic: array ] 2019-08-08 21:30:18 +03:00
Alexander T 11ec6118fb @typescript-eslint/array-type 2019-07-29 18:39:11 +03:00
Alexander T 36a6028d56 Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint 2019-07-19 10:16:10 +03:00
Jake Boone c30ba7884c
Fix capitalization in parseInt description 2019-07-18 12:38:14 -07:00
Alexander T 68ae4382bd jsdoc/check-alignment 2019-07-18 15:06:56 +03:00
Alexander T f6a50067d3 @typescript-eslint/indent 2019-06-27 11:30:03 +03:00
Nathan Shively-Sanders b36c8a0690
Make anyArray.filter(Boolean) return any[], not unknown[] (#31515)
* Add this-parameter workaround to Array.filter

Allows anys.filter(Boolean) to once again return any[], not unknown[].

* Add any constraint to Boolean factory function

I want to test how well this works.

* Remove Boolean factory type guard

* Remove typeGuardBoolean test
2019-05-22 09:45:41 -07:00
Daniel Rosenwasser d9e82466e2 Change Omit back to using Pick<T, Exclude<keyof T, K>> in order to maintain modifiers. 2019-05-01 14:00:11 -07:00
ExE Boss 1d8398265a fix(lib): Loosen Array predicate return types (#31076)
* fix(lib): Loosen `Array` predicate return types

* test(lib): Update baseline files
2019-04-30 09:47:13 -07:00
Forbes Lindesay 3ce3cde493 Allow Boolean() to be used to perform a null check (#29955)
* Allow Boolean() to be used to perform a null check

* Add missing test case output
2019-04-30 08:09:31 -07:00
Clay Miller d934401265 Change the type of 'uriComponent' (passed to 'encodeURIComponent') from 'string' to 'string | number | boolean'. Fixes #18159 (#31103)
- According to the ECMAScript 5.1 spec (§15.1.3.4), 'encodeURIComponent' invokes the abstract operation 'ToString': https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4
- In the spec (§9.8), 'ToString' accepts an 'Undefined', 'Null', 'Boolean', 'Number', 'String' or 'Object' argument: https://www.ecma-international.org/ecma-262/5.1/#sec-9.8
- TypeScript’s 'StringConstructor' accepts an argument with type 'any': b0100100a1/lib/lib.es5.d.ts (L518)
2019-04-26 13:07:14 -07:00
Daniel Rosenwasser 57938e6cc2 Make Omit alias its own mapped type so that references to it never expand to Pick<...>. 2019-04-24 16:57:20 -07:00
Jordan Harband d4ff58d53f [fix] ES5 Object.keys only accepts an object (#27089) 2019-04-24 10:18:31 -07:00
Daniel Rosenwasser 13d2b8d617 Add the Omit helper type. 2019-04-04 10:01:34 -07:00
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
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 d85c4e551e
Merge pull request #27121 from xl1/26977-typedarray
Allow non-number source for TypedArray.from
2019-01-24 13:42:43 -08: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
AnyhowStep 01e71820fc Fixes Microsoft/TypeScript#6955 2018-10-31 17:00:24 -04:00
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
xl1 9819b6b7aa Allow non-number array for source of TypedArray.from 2018-09-15 23:00:01 +09: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
Nathan Shively-Sanders c929e74310
Add [Constructor]Parameter types to lib.d.ts (#26243) 2018-08-31 07:46:16 -07:00
Daniel Rosenwasser b8ca925de0 Place 'pop' first in 'Array'. 2018-07-10 19:34:19 -07:00
Wesley Wigham 616e6e6ca3
Move symbol instance type to es5 to follow PropertyKey (#23864)
* Move symbol instance type to es5

* Accept baseline changes from moving Symbol
2018-05-03 10:50:10 -07:00
Daniel Rosenwasser 9672116d8c Merge remote-tracking branch 'origin/master' into importDotMeta 2018-04-25 22:21:56 -07:00
Daniel Rosenwasser a55febda77 Make 'ImportMeta' more minimal. 2018-04-24 12:38:42 -07:00
Anders Hejlsberg 16cd5580a6 Merge branch 'master' into improveIndexTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/server/utilities.ts
2018-04-16 16:18:29 -07:00
Daniel Rosenwasser f0081f0a04 Basic checking for 'import.meta'. 2018-04-10 12:59:03 -07:00
Anders Hejlsberg 68ce69a351 Move 'PropertyKey' from es2015.core.d.ts to es5.d.ts 2018-04-09 07:45:55 -10:00
Holger Jeromin c3d8ec0ee2
refactor: use union type in DateConstructor 2018-04-06 11:27:20 +02:00
Priyantha Lankapura 80464e8ff1 fix typo in intellisense (#21914) 2018-02-13 18:52:33 -08:00
Anders Hejlsberg 2cc1d735ec Add Required<T> to lib.d.ts 2018-02-13 06:47:52 -08:00
Anders Hejlsberg 2aba29fc32 Add Exclude, Extract, NonNullable, ReturnType, and InstanceType types 2018-02-09 14:22:46 -08:00