742 Commits

Author SHA1 Message Date
gfyoung
ba3645e034
fix(48218): Split Intl.DisplayNames options (#48262)
Closes https://github.com/microsoft/TypeScript/issues/48218
2022-03-22 17:22:30 -07:00
Mateusz Burzyński
ca65a1a05b
Add boolean to supported literals within Object.freeze (#48117) 2022-03-14 09:07:31 -07:00
Ryan Cavanaugh
a4f5555e09
Move hasOwn from Object instance to Object constructor (#48207)
Fixes #48206
2022-03-10 15:28:47 -08:00
jihndai
1f52ca8441
Require tag parameter and allow Locale object as argument to Intl.Locale() constructor (#48019)
* mark tag as required, and can accept another Locale object

* add tests and baselines

* update baselines
2022-03-04 09:04:57 -08:00
Wesley Wigham
ddad61e1b0
Add an overload to Object.freeze that preserves literal types (#33767)
* Add an overload to Object.freeze that preserves literal types

* Accept changes baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-03-03 14:23:41 -08:00
PaulHan
0a24dee97d
fix: add this type for Reflect.defineProperty (#33544)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-03-03 11:01:12 -08:00
jihndai
1abc47b882
Add Intl.Locale parameter type to toLocale[X]String signatures. (#47811)
* add Intl.Locale param type to locales argument in BigInt, Number, and Date methods

* update baselines

* add test for locales object arguments

* fix indentation
2022-02-28 14:10:18 -08:00
Nathan Shively-Sanders
2477ff915e
Fix object.assign first param constraint (#40909)
* fixes #35621

* undo changes to generated file

* undo whitespace fixup attempt

* update baselines

Co-authored-by: TrejGun <trejgun@gmail.com>
2022-02-18 13:30:07 -08:00
islandryu
b8b1201e44
fix(47024):fix type of DateTimeFormat and NumberFormat (#47117)
* fix type of DateTimeFormat and NumberFormat

* add NumberFormat to esnext.intl.d.ts

* Update src/lib/esnext.intl.d.ts

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

* better unification of previous changes

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-02-17 15:37:43 -08:00
webstrand
66dba1331b
Fix #38482 making ThisParameterType<T> more general (#47162)
`ThisParameterType<(...args: X) => void>` expands to
`(...args: X) => void extends (this: infer U, ...args: any[]) => any`.
When `X` is an unresolved type parameter it is not possible to determine
that `any[]` is assignable to `X`. However `never` is always assignable
to `X`, so we use that instead.
2022-02-17 11:28:22 -08:00
swandir
3b95404f59
Make Intl.Locale baseName and language properties required (#47720) 2022-02-15 15:26:25 -08:00
Vritant Bhardwaj
0798faf596
Add support for formatRange to Intl.DateTimeFormat (#47740)
* add interface for DateTimeFormat.format

* remove railing whitespace
2022-02-15 14:53:44 -08:00
Nathan Shively-Sanders
3f55d68761
Manual revert of AbortSignal.abort in webworker.generated.d.ts (#47675)
Same as #47643, I just missed it until looking at remaining DT failures.

I need to update the DOM-lib-generator automation, but for now I want to
get TS types corrected.
2022-01-31 11:30:57 -08:00
Nathan Shively-Sanders
61b7bbb026
Revert to temporary AbortSignal fix (#47643)
I forgot to keep the temporary fix when I updated the DOM yesterday.
2022-01-27 13:28:17 -08:00
Nathan Shively-Sanders
53b96d9ddf
Update DOM 2022-01-26 (#47623)
Improves types for FileSystemHandle.kind in subtypes, plus other bcd
updates.
2022-01-26 12:29:25 -08:00
Orta Therox
818962087c
Update dom.generated.d.ts (#47507) 2022-01-19 12:45:43 +00:00
TypeScript Bot
4e689bc075
🤖 Update TypeScript DOM Libs (#47445)
Co-authored-by: orta <orta@users.noreply.github.com>
2022-01-18 17:43:20 -08:00
Robert Snow
08221166d9
Add missing currencyDisplay to resolved number format options (#44006)
* Add missing currencyDisplay to resolved number format options

* Move declaration to es2020

* Update es2020.intl.d.ts

* Fix bad merge

Co-authored-by: Orta Therox <ortam@microsoft.com>
Co-authored-by: Orta Therox <git@orta.io>
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2022-01-18 13:54:25 -08:00
Pimm "de Chinchilla" Hogeling
cecd8c50a0
Make Map constructor argument optional and nullable (#43396)
* Make Iterable Map constructor argument optional

Fixes #37779

* Change Map constructor in iterable to accept both null and undefined.

According to the spec (https://tc39.es/ecma262/#sec-map-iterable), the sole argument passed to Map is allowed to be null or undefined.

* Changed Map constructor to ensure new Map() still types as Map<any, any>.

* Add map constructor test.

This proves that the previous commit fixes #37779, as well as that new Map() still types as Map<any, any>.

* Update baseline.

Co-authored-by: Jared Neil <jaredneil@lucidchart.com>
2022-01-18 13:39:05 +00:00
Kagami Sascha Rosylight
363e3a78f4
Add Error.prototype.cause (#47020)
* Add `Error.prototype.cause`

Fixes #47019

* Update test baselines
2022-01-07 14:58:58 +00:00
gfyoung
9a75d2acc8
fix(46845): Add missing "locale" field to Intl.DisplayNamesOptions (#46849)
Closes https://github.com/microsoft/TypeScript/issues/46845
2022-01-03 20:10:20 +00:00
Tao Cumplido
2bbdb31b07
update es2020.intl DisplayNames#of (#47157)
fix return type of Intl.DisplayNames.prototype.of
was typed to return always string but can actually return undefined too
see spec https://tc39.es/ecma402/#sec-Intl.DisplayNames.prototype.of
2021-12-15 17:51:35 +00:00
Ron Buckton
67f84ef771
Fix Awaited<T> for onfulfilled callbacks with more than one argument (#46951) 2021-12-07 15:21:11 -08:00
Mohammad Aziz
fe3e117cb2
fix(46712): Add "exceptZero" for "signDisplay" option of Intl.NumberFormat() (#46740) 2021-11-12 11:12:21 +00:00
Nathan Shively-Sanders
9713cc1a75
Big[U]Int64Array.at returns bigint, not number (#46733)
bigint is needed to represent all 64-bit ints that these arrays could
contain.
2021-11-08 09:50:02 -08:00
Kagami Sascha Rosylight
ae582a22ee
Add target: "es2022" (#46291)
* Add `target: "es2022"`

* Add Object.hasOwn

* formatToParts is es2018

* ref update

* optional parameter

* Revert "optional parameter"

This reverts commit e67d6e5f6062d72b830893e9988840779cb7fa8c.

* undefined

* error cause

* Lint fix

Co-authored-by: Orta <git@orta.io>
2021-11-04 10:55:11 -07:00
Anders Hejlsberg
33fe1b6ffc
Fix contextual typing for symbol-named properties (#46558)
* Properly handle symbol-named properties in contextual types

* Update index signature in PropertyDescriptorMap

* Add regression tests
2021-11-02 14:05:41 -07:00
TypeScript Bot
4e237ed66f
🤖 Update TypeScript DOM Libs (#46222)
Co-authored-by: orta <orta@users.noreply.github.com>
2021-10-28 09:14:26 -07:00
Warren Lu
5725cfeb10
Fix typos in es5.d.ts (#46321) 2021-10-21 11:59:01 -07:00
John McEntee
5d0d7ae85d
fix(45876): Remove "ascii character" order from docs for Float64Array.sort (#45883)
* fix(45876): Do not specify ascii chracter order in docs for Float64Array.sort() when compareFn is omitted.

* fix(45876): Do not specify ascii chracter order in docs for any TypedArray.sort() when compareFn is omitted.
2021-09-29 11:05:01 -07:00
Yoshiya Hinosawa
2667c6013c
Update parameter types of RegExp compile method (#46038) 2021-09-29 09:27:21 -07:00
Orta Therox
d6cd2c7c11
Updates the DOM APIs (#46080)
* Updates the DOM APIs

* Tests

* Remove static abort(): AbortSignal
2021-09-27 22:07:57 +01:00
Orta Therox
61d2939359
Adds more Intl.ResolvedDateTimeFormatOptions, and hooks up Intl for ES2021 (#45905)
* Adds more ResolvedDateTimeFormatOptions to the Intl APIs

* Fix tests
2021-09-23 21:33:37 +01:00
Wenlu Wang
ec114b8931
Import assertion (#40698)
* Add parsing

* fix all api

* check gramma of import call

* Add more part of assertion

* Add some case

* Add baseline

* use module insted of target

* strip assertion in d.ts

* Update new baseline

* accept baseline

* Revert error number changes

* Update diagnostic message

* Accept baseline

* rename path

* Fix cr issues

* Accept baseline

* Accept baseline

* Error if assertion and typeonly import

* Accept baseline

* Make lint happy

* Add some comment

* Fix cr issues

* Fix more issue

* Incorporate PR feedback, fix module resolution for import()

* Add contextual type and completions for ImportCall options argument

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-09-20 14:15:22 -07:00
Ron Buckton
b23f44aee5
Simplify a branch of the Awaited type and clean up comments (#45918) 2021-09-16 15:04:09 -07:00
Orta Therox
7cba51947a
Go back to the old spelling of NumberFormatPartTypes to not break DT (#45889) 2021-09-15 18:21:39 +01:00
Orta Therox
2eecb3d954
Adds back NumberFormatPartType to the global types from intl (#45843) 2021-09-13 20:02:38 +01:00
Orta Therox
13bdc03ab5
Intl fix for nightly (#45820)
* Fix #45804

* Update src/lib/es2020.intl.d.ts

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* More fixes

* Adds a test

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
2021-09-10 19:46:46 +01:00
Ron Buckton
ea521d45e9
Adds 'Awaited' type alias and updates to Promise.all/race/allSettled/any (#45350)
* Adds 'Awaited' type alias and updates to Promise.all/race/allSettled/any

* Use Awaited<T> with 'await'

* Clean up overloads

* Further restrict 'Awaited<T>' auto-wrapping for 'await'
2021-09-09 18:23:17 -07:00
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
Nathan Shively-Sanders
b8ace9d312
Restore HTMLDocument constructable value in DOM (#45554)
Don't touch anything else in the DOM.
2021-08-23 15:56:11 -07:00
Orta Therox
b9e952be1d
Migrate over 4.4 lib dom and webworker (#45324)
* Brings across 4.4 DOM + Web Worker changes

* Adds tests

* Incorporate #1092 and #1093 from TypeScript-DOM-lib-generator

* update baselines

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-08-04 17:14:24 -07:00
Orta Therox
9ebe11c2d3
Migrate latest dom types into libdom.d.ts (#44684)
* Add the types_web dom dts

* Update

* Adds new DTS

* Update baselines
2021-06-25 14:25:30 -07:00
Jujhar Singh
98f04e224f
IntelliSense doc string.replace typo (#41385)
* Fix IntelliSense doc string.replace typo

* Update IntelliSense doc string.replace

* Update string.replace doc text

* Revert "Fix IntelliSense doc string.replace typo"

This reverts commit 4220ec8a9487a0854aea67ed0e0805cf8f97c690.

* Reworded string.replace doc text

* Fix doc string.replace text
2021-05-25 08:05:27 -07:00
Mark Fulton
7901f351eb
fix(WeakMapConstructor): readonly iterable items (#43905)
like `MapConstructor`, `WeakMapConstructor` should support receiving `Iterable<readonly [K, V]>` instead of `Iterable<[K, V]>`; otherwise tuples creates with `as const`, etc. cannot be safely passed in without casts, etc.
2021-05-20 07:18:58 -07:00
Sang
811b1f696d
improve jsdoc for array fill methods (#43627) 2021-05-18 17:25:38 -07:00
Matas Rastenis
fde2c55652
fix(43799): Support bigint type for Intl.NumberFormat.formatToParts (#44015)
* Add bigint support for formatToParts

* Add tests for Intl.NumberFormat.formatToParts

* Cleanup test

* Fix EOL symbols

* Update baseline test
2021-05-18 17:05:18 -07:00
Eli Barzilay
0454ae4720 Loosen up the first argument type for String.raw
The [String.raw spec](https://tc39.es/ecma262/#sec-string.raw) uses just
the `raw` property of its first argument, which is a useful way of using
it in user-defined tag functions to do the work of interleaving strings
and values as well as converting the values to strings.

Fixes #43609.
2021-05-12 14:13:26 -04:00