Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren committed Jun 20, 2024
1 parent 2df9f0e commit 4df8aa9
Show file tree
Hide file tree
Showing 20 changed files with 194,486 additions and 412,613 deletions.
2 changes: 1 addition & 1 deletion typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub Actions CI](https://github.com/microsoft/TypeScript/workflows/CI/badge.svg)](https://github.com/microsoft/TypeScript/actions?query=workflow%3ACI)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/microsoft/TypeScript/badge)](https://securityscorecards.dev/viewer/?uri=github.com/microsoft/TypeScript)


[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
Expand Down
244 changes: 211 additions & 33 deletions typescript/lib/lib.dom.d.ts

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions typescript/lib/lib.dom.iterable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ and limitations under the License.
/// Window Iterable APIs
/////////////////////////////

interface AbortSignal {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */
any(signals: Iterable<AbortSignal>): AbortSignal;
}

interface AudioParam {
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueCurveAtTime) */
setValueCurveAtTime(values: Iterable<number>, startTime: number, duration: number): AudioParam;
Expand Down Expand Up @@ -83,6 +88,9 @@ interface CanvasPathDrawingStyles {
setLineDash(segments: Iterable<number>): void;
}

interface CustomStateSet extends Set<string> {
}

interface DOMRectList {
[Symbol.iterator](): IterableIterator<DOMRect>;
}
Expand Down
40 changes: 40 additions & 0 deletions typescript/lib/lib.es2015.core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ interface Array<T> {
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): this;

toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
}

interface ArrayConstructor {
Expand Down Expand Up @@ -360,6 +362,8 @@ interface ReadonlyArray<T> {
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number;

toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string;
}

interface RegExp {
Expand Down Expand Up @@ -555,3 +559,39 @@ interface StringConstructor {
*/
raw(template: { raw: readonly string[] | ArrayLike<string>; }, ...substitutions: any[]): string;
}

interface Int8Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Uint8Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Uint8ClampedArray {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Int16Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Uint16Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Int32Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Uint32Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Float32Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}

interface Float64Array {
toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string;
}
20 changes: 16 additions & 4 deletions typescript/lib/lib.es2018.intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,22 @@ declare namespace Intl {

const PluralRules: PluralRulesConstructor;

// We can only have one definition for 'type' in TypeScript, and so you can learn where the keys come from here:
type ES2018NumberFormatPartType = "literal" | "nan" | "infinity" | "percent" | "integer" | "group" | "decimal" | "fraction" | "plusSign" | "minusSign" | "percentSign" | "currency" | "code" | "symbol" | "name";
type ES2020NumberFormatPartType = "compact" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "unit" | "unknown";
type NumberFormatPartTypes = ES2018NumberFormatPartType | ES2020NumberFormatPartType;
interface NumberFormatPartTypeRegistry {
literal: never;
nan: never;
infinity: never;
percent: never;
integer: never;
group: never;
decimal: never;
fraction: never;
plusSign: never;
minusSign: never;
percentSign: never;
currency: never;
}

type NumberFormatPartTypes = keyof NumberFormatPartTypeRegistry;

interface NumberFormatPart {
type: NumberFormatPartTypes;
Expand Down
5 changes: 2 additions & 3 deletions typescript/lib/lib.es2020.bigint.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ interface BigInt64Array {
subarray(begin?: number, end?: number): BigInt64Array;

/** Converts the array to a string by using the current locale. */
toLocaleString(): string;
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;

/** Returns a string representation of the array. */
toString(): string;
Expand Down Expand Up @@ -641,7 +641,7 @@ interface BigUint64Array {
subarray(begin?: number, end?: number): BigUint64Array;

/** Converts the array to a string by using the current locale. */
toLocaleString(): string;
toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string;

/** Returns a string representation of the array. */
toString(): string;
Expand Down Expand Up @@ -723,6 +723,5 @@ interface DataView {
declare namespace Intl {
interface NumberFormat {
format(value: number | bigint): string;
resolvedOptions(): ResolvedNumberFormatOptions;
}
}
39 changes: 32 additions & 7 deletions typescript/lib/lib.es2020.intl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,24 +241,49 @@ declare namespace Intl {
): UnicodeBCP47LocaleIdentifier[];
};

interface NumberFormatOptionsStyleRegistry {
unit: never;
}

interface NumberFormatOptionsCurrencyDisplayRegistry {
narrowSymbol: never;
}

interface NumberFormatOptionsSignDisplayRegistry {
auto: never;
never: never;
always: never;
exceptZero: never;
}

type NumberFormatOptionsSignDisplay = keyof NumberFormatOptionsSignDisplayRegistry;

interface NumberFormatOptions {
numberingSystem?: string | undefined;
compactDisplay?: "short" | "long" | undefined;
notation?: "standard" | "scientific" | "engineering" | "compact" | undefined;
signDisplay?: "auto" | "never" | "always" | "exceptZero" | undefined;
signDisplay?: NumberFormatOptionsSignDisplay | undefined;
unit?: string | undefined;
unitDisplay?: "short" | "long" | "narrow" | undefined;
currencyDisplay?: string | undefined;
currencySign?: string | undefined;
currencySign?: "standard" | "accounting" | undefined;
}

interface ResolvedNumberFormatOptions {
compactDisplay?: "short" | "long";
notation?: "standard" | "scientific" | "engineering" | "compact";
signDisplay?: "auto" | "never" | "always" | "exceptZero";
notation: "standard" | "scientific" | "engineering" | "compact";
signDisplay: NumberFormatOptionsSignDisplay;
unit?: string;
unitDisplay?: "short" | "long" | "narrow";
currencyDisplay?: string;
currencySign?: string;
currencySign?: "standard" | "accounting";
}

interface NumberFormatPartTypeRegistry {
compact: never;
exponentInteger: never;
exponentMinusSign: never;
exponentSeparator: never;
unit: never;
unknown: never;
}

interface DateTimeFormatOptions {
Expand Down
40 changes: 31 additions & 9 deletions typescript/lib/lib.es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ interface Date {
getMilliseconds(): number;
/** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */
getUTCMilliseconds(): number;
/** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */
/** Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local computer. */
getTimezoneOffset(): number;
/**
* Sets the date and time value in the Date object.
Expand Down Expand Up @@ -4433,12 +4433,33 @@ declare namespace Intl {

var Collator: CollatorConstructor;

interface NumberFormatOptionsStyleRegistry {
decimal: never;
percent: never;
currency: never;
}

type NumberFormatOptionsStyle = keyof NumberFormatOptionsStyleRegistry;

interface NumberFormatOptionsCurrencyDisplayRegistry {
code: never;
symbol: never;
name: never;
}

type NumberFormatOptionsCurrencyDisplay = keyof NumberFormatOptionsCurrencyDisplayRegistry;

interface NumberFormatOptionsUseGroupingRegistry {}

type NumberFormatOptionsUseGrouping = {} extends NumberFormatOptionsUseGroupingRegistry ? boolean : keyof NumberFormatOptionsUseGroupingRegistry | "true" | "false" | boolean;
type ResolvedNumberFormatOptionsUseGrouping = {} extends NumberFormatOptionsUseGroupingRegistry ? boolean : keyof NumberFormatOptionsUseGroupingRegistry | false;

interface NumberFormatOptions {
localeMatcher?: string | undefined;
style?: string | undefined;
localeMatcher?: "lookup" | "best fit" | undefined;
style?: NumberFormatOptionsStyle | undefined;
currency?: string | undefined;
currencySign?: string | undefined;
useGrouping?: boolean | undefined;
currencyDisplay?: NumberFormatOptionsCurrencyDisplay | undefined;
useGrouping?: NumberFormatOptionsUseGrouping | undefined;
minimumIntegerDigits?: number | undefined;
minimumFractionDigits?: number | undefined;
maximumFractionDigits?: number | undefined;
Expand All @@ -4449,14 +4470,15 @@ declare namespace Intl {
interface ResolvedNumberFormatOptions {
locale: string;
numberingSystem: string;
style: string;
style: NumberFormatOptionsStyle;
currency?: string;
currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
minimumIntegerDigits: number;
minimumFractionDigits: number;
maximumFractionDigits: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
useGrouping: boolean;
useGrouping: ResolvedNumberFormatOptionsUseGrouping;
}

interface NumberFormat {
Expand Down
Loading

0 comments on commit 4df8aa9

Please sign in to comment.