Commit graph

157 commits

Author SHA1 Message Date
Orta Therox 07fd7bce64
Intl 2021 Updates (#45647)
* Import of Intl.Locale from #39664

* Handle updating es2020.intl and add es2021 for new DateTimeFormatOptions options - re: #39664

* Extends DateTimeFormatOptions for new Intl APIs - re: #45420

* Handle migrating Intl.NumberFormat.formatToParts to es2018 (keeping esnext.intl around)

* Adds Intl.DisplayNames to es2020 - re: #44022

* Remove attributes added in es2021 from es2020 - re: #42944

* Add a reference to es2021 in the command line parser

* Adds some docs about the lib files

* Baselines

* Allow undefined in Intl inputs to allow for ergonomic usage of exactOptionalPropertyTypes - see #45652

* Adds some tests covering the APIs

* Apply suggestions from code review

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Handle PR feedback

* More review improvements

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-09-08 10:43:01 +01:00
Kenta Moriuchi d699bcdaae
Update lib types to mark Annex B as deprecated (#43710)
* Mark properties defined in Annex B as deprecated

* Tweak

* Update baselines

* Update fourslash tests

* Add completionsStringMethods.ts test

* Fix sortText value in fourslash test for deprecated tags

* Update package-lock.json

* Update package-lock.json

* Mark Non-standard RegExp Constructor properties as deprecated

* Update baselines

Co-authored-by: TypeScript Bot <typescriptbot@microsoft.com>
2021-08-30 10:38:07 -07:00
Tim 1dc1efbc4f
Update es5.d.ts (#45454)
* Update es5.d.ts

Fix grammar error.

* Update src/lib/es5.d.ts

* Update src/lib/es5.d.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-08-26 23:10:25 -07:00
Sang 811b1f696d
improve jsdoc for array fill methods (#43627) 2021-05-18 17:25:38 -07:00
Greg Finley 11097c622c
Fix typo (#43404)
* Fix typo

* Fix off baseline

Co-authored-by: Orta <git@orta.io>
2021-03-29 12:14:44 +01:00
Ron Buckton e10a32591c
Use 'abstract new' in InstanceType and ConstructorParameters (#43380) 2021-03-25 15:27:06 -07:00
Matthew Pietz dcaefe732e
Accept generics for defineProperty (#42424)
* Accept generics for defineProperty

Both `Object.defineProperty()` and `Object.defineProperties()` return their
first argument. Use a generic so that typings can be passed through.

* Update baselines

* update missed baseline

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-11 07:57:42 -08:00
Sang 612a96e161
Update parseInt parameter name and jsdoc (#42756)
* feat(lib): improve parseInt type definition and docstring

* Accepted baselines

* update tests
2021-03-05 11:23:08 -08:00
Daniel Rosenwasser 654975481f
Use spaces instead of non-breaking spaces, narrow non-breaking spaces. (#42500) 2021-02-03 14:29:42 -08:00
Brandon Pickering 822962e7b3
Improve documentation for basic array methods (#41961)
* Improve documentation for basic array methods

* Accept baseline changes for new lines from JSDoc changes

Co-authored-by: Orta <git@orta.io>
2021-01-04 10:06:01 +00:00
Baptiste Darthenay e4c4292807
fix(42128): Stricter type for ES5 Intl, redefine ES2020 intl (#42134) 2020-12-28 13:46:47 +00:00
Orta Therox 71e881a7ee
Undo #39258 (isArray changes) see overview at #41808 (#41851) 2020-12-07 21:59:26 +00:00
Mauro Bringolf 48ad25d4b9
Add currency sign to NumberFormatOptions type (#40709) 2020-10-06 16:30:09 -07:00
jieniu$ 58af7defe4
Fix typo in JSON.stringify doc (#40735) 2020-10-01 09:46:58 -07:00
Anders Hejlsberg fbce4f6c98
Intrinsic string types (#40580)
* Introduce Uppercase<T> and Lowercase<T> intrinsic types

* Accept new API baselines

* Add Uppercase/Lowercase/Capitalize/Uncapitalize to lib.d.ts

* Update fourslash

* Add an 'intrinsic' keyword

* Update template literal type tests

* Accept new API baselines

* Minor fixes

* Switch Capitalize<T> and Uncapitalize<T> to intrinsic types

* Add tests

* Accept new baselines

* Accept new baselines

* Remove template literal type casing modifiers

* Update tests

* Accept new baselines

* Add more tests

* Normalize nested template literal types

* Add normalization tests

* Accept new baselines

* Update tests
2020-09-21 07:09:29 -10:00
Orta Therox fa89ce6158
Remove assignability cases in getNarrowedType + an isArray improvement for readonly arrays (#39258)
* Explore using a different isArray declaration

* Add tests and the new isArray definition

* Baseline updates

* Upda the isArray type
2020-09-08 14:43:48 -04:00
Ron Buckton d5a646eb66
Remove optionality for Promise resolve callback (#39817) 2020-09-03 17:21:53 -07:00
devsnek a0d457e14c
Add missing properties to stdlib (#38678) 2020-08-18 23:05:38 -07:00
Nathan Shively-Sanders 065b83b902 Make numeric Array constructors take ArrayLikeBuffer union
PR #38449 changed the second overload of the constructor for Int8,
Uint8, Int32, Uint32, Int16, Uint16, Float, Float64 -Array so that it no
longer includes `ArrayBufferLike`. It's just `ArrayLike<number>`.
This is fine except in the case that
the caller provides exactly `ArrayLike<number> | ArrayBufferLike`. This
PR adds ArrayBufferLike back so that the union is once again accepted.

This avoids a breaking change, in particular in one Microsoft-internal
codebase.
2020-08-03 14:56:55 -07:00
Micah Zoltu b601487905
Updates Uint8ArrayConstructor to match MDN documentation. (#38449)
* Updates Uint8ArrayConstructor to match MDN documentation.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/Uint8Array
```
new Uint8Array(); // new in ES2017
new Uint8Array(length);
new Uint8Array(typedArray);
new Uint8Array(object);
new Uint8Array(buffer [, byteOffset [, length]]);
```
While the previous constructors aren't significantly different from the new, it would prevent someone from doing `new Uint8Array(myBuffer, undefined, undefined)` since there was no overload that accepted undefined as a second parameter and buffer as first.
Fixes #38446

* Fixes constructor defenition for all other typed arrays.

* Renames property to `array` since it is no longer an `arrayOrBuffer`.
2020-07-30 08:51:50 -04:00
Alexey Shvayka 520103fab0
Rename callbackfn params to predicate where possible (#39150)
* Rename `callbackfn` params to `predicate` where possible

* Perform `gulp baseline-accept`
2020-06-18 16:44:57 -07:00
Dmitri 0bc29acc08
Add a type-guard overload of Array.every (#38200)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-06-17 13:02:30 -07:00
Daniel Rosenwasser d28e38f573
Revert "make splice deleteCount required in es5.d.ts (#32643)" (#38169)
This reverts commit ddcf139668.
2020-04-24 14:30:28 -07:00
Ron Buckton 4fc4c4e3d6
Revert 'awaited' type (#37610) 2020-03-25 18:39:45 -07:00
Ron Buckton e3ec7b18b8
Add the 'awaited' type operator (#35998)
* Add the 'awaited' type operator

* Add script to manually add reviewers to a PR when GH 'Suggested Reviewers' breaks

* Fix lint error in review script

* Only defer generic awaited type for possible thenable

* Add variance-like behavior for awaited

* Switch awaited type params to 'unreliable' variance

* fix typo in inferTypes

* LKG without syntax in lib

* LKG with new syntax in lib

* Add 'strictAwaitedTypes' flag

* Treat strictAwaitedTypes as strict-mode flag

* Rename TAll, remove duplicate definition of 'race'

* Apply suggestions from code review

Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

* Fix inference priority

* Update comment to isGenericAwaitableType

* Add overloads for then/catch to Promise

* Add inference heuristic for T | PromiseLike<T> (for any PromiseLike)

* Remove strictAwaitedTypes flag

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
2020-03-20 16:09:01 -07:00
Cayman 4432178ded
Add valueOf declarations for TypedArrays (#36668) 2020-03-13 16:50:16 -04:00
Tom Jenkinson ddcf139668
make splice deleteCount required in es5.d.ts (#32643)
* make splice `deleteCount` required in es5.d.ts

In ES5 `deleteCount` is not an optional argument. If it is not provided it defaults to 0 as a side effect of `undefined` being converted to an integer.

In ES6 `deleleteCount` is optional, and it defaults to the length of the array minus the start index.

If you are targeting ES5 but don't provide `deleteCount` the behaviour will be different depending on the environment your build is running in.

fixes #32638

* update baselines
2020-03-12 14:28:14 -07:00
Nathan Shively-Sanders 8da3eff7b0
Subtypes of ErrorConstructor extend it (#35549)
Previously subtypes of Error extended Error, but the matching subtypes
of ErrorConstructor did not extend ErrorConstructor. The members in
es5.d.ts are identical, so there's no need except for allowing interface
merging into ErrorConstructor to affect subtypes as well.
2020-01-29 13:26:00 -08:00
Anders Hejlsberg df3b5bbdab
Fix ThisParameterType<T> type (#36013)
* Simplify ThisParameterType<T> type

* Add tests
2020-01-06 08:55:34 -10:00
Martin Johns 408b17649a doc(lib/es5): Fix grammar in DateConstructor.UTC documentation (#34509)
This fixes #34507.
2019-10-16 08:33:22 -07:00
Martin b7c85c7382 Update Math.round in es5.d.ts (#33920)
Update documentation of Math.round to reflect that it turns a float in to an integer and returns an integer.
2019-10-14 10:55:55 -07:00
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