Skip to content

feat(#48863): Split ES5 lib into individual parts #49853

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
63 changes: 53 additions & 10 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,59 @@ namespace ts {
["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
["webworker.iterable", "lib.webworker.iterable.d.ts"],
["scripthost", "lib.scripthost.d.ts"],
// ES2015 Or ESNext By-feature options
["es2015.core", "lib.es2015.core.d.ts"],
["es2015.collection", "lib.es2015.collection.d.ts"],
["es2015.generator", "lib.es2015.generator.d.ts"],
["es2015.iterable", "lib.es2015.iterable.d.ts"],
["es2015.promise", "lib.es2015.promise.d.ts"],
["es2015.proxy", "lib.es2015.proxy.d.ts"],
["es2015.reflect", "lib.es2015.reflect.d.ts"],
["es2015.symbol", "lib.es2015.symbol.d.ts"],
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
// Utilities
["utils.import", "lib.utils.import.d.ts"],
["utils.modifiers", "lib.utils.modifiers.d.ts"],
// ES20XX Or ESNext By-feature options
["es2009.array", "lib.es2009.array.d.ts"],
["es2009.arraybuffer", "lib.es2009.arraybuffer.d.ts"],
["es2009.boolean", "lib.es2009.boolean.d.ts"],
["es2009.core", "lib.es2009.core.d.ts"],
["es2009.dataview", "lib.es2009.dataview.d.ts"],
["es2009.date", "lib.es2009.date.d.ts"],
["es2009.error", "lib.es2009.error.d.ts"],
["es2009.evalerror", "lib.es2009.evalerror.d.ts"],
["es2009.float32array", "lib.es2009.float32array.d.ts"],
["es2009.float64array", "lib.es2009.float64array.d.ts"],
["es2009.function", "lib.es2009.function.d.ts"],
["es2009.int16array", "lib.es2009.int16array.d.ts"],
["es2009.int32array", "lib.es2009.int32array.d.ts"],
["es2009.int8array", "lib.es2009.int8array.d.ts"],
["es2009.intl", "lib.es2009.intl.d.ts"],
["es2009.json", "lib.es2009.json.d.ts"],
["es2009.math", "lib.es2009.math.d.ts"],
["es2009.number", "lib.es2009.number.d.ts"],
["es2009.object", "lib.es2009.object.d.ts"],
["es2009.promise", "lib.es2009.promise.d.ts"],
["es2009.rangeerror", "lib.es2009.rangeerror.d.ts"],
["es2009.referenceerror", "lib.es2009.referenceerror.d.ts"],
["es2009.regexp", "lib.es2009.regexp.d.ts"],
["es2009.string", "lib.es2009.string.d.ts"],
["es2009.symbol", "lib.es2009.symbol.d.ts"],
["es2009.syntaxerror", "lib.es2009.syntaxerror.d.ts"],
["es2009.typeerror", "lib.es2009.typeerror.d.ts"],
["es2009.uint16array", "lib.es2009.uint16array.d.ts"],
["es2009.uint32array", "lib.es2009.uint32array.d.ts"],
["es2009.uint8array", "lib.es2009.uint8array.d.ts"],
["es2009.uint8clampedarray", "lib.es2009.uint8clampedarray.d.ts"],
["es2009.urierror", "lib.es2009.urierror.d.ts"],
["es2015.array", "lib.es2015.array.d.ts" ],
["es2015.collection", "lib.es2015.collection.d.ts" ],
["es2015.core", "lib.es2015.core.d.ts" ],
["es2015.date", "lib.es2015.date.d.ts" ],
["es2015.function", "lib.es2015.function.d.ts" ],
["es2015.generator", "lib.es2015.generator.d.ts" ],
["es2015.iterable", "lib.es2015.iterable.d.ts" ],
["es2015.math", "lib.es2015.math.d.ts" ],
["es2015.number", "lib.es2015.number.d.ts" ],
["es2015.object", "lib.es2015.object.d.ts" ],
["es2015.promise", "lib.es2015.promise.d.ts" ],
["es2015.proxy", "lib.es2015.proxy.d.ts" ],
["es2015.reflect", "lib.es2015.reflect.d.ts" ],
["es2015.regexp", "lib.es2015.regexp.d.ts" ],
["es2015.string", "lib.es2015.string.d.ts" ],
["es2015.symbol", "lib.es2015.symbol.d.ts" ],
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts" ],
["es2016.array.include", "lib.es2016.array.include.d.ts"],
["es2017.object", "lib.es2017.object.d.ts"],
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
Expand Down
261 changes: 261 additions & 0 deletions src/lib/es2009.array.d.ts

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions src/lib/es2009.arraybuffer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Represents a raw buffer of binary data, which is used to store data for the
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
* but can be passed to a typed array or DataView Object to interpret the raw
* buffer as needed.
*/
interface ArrayBuffer {
/**
* Read-only. The length of the ArrayBuffer (in bytes).
*/
readonly byteLength: number;

/**
* Returns a section of an ArrayBuffer.
*/
slice(begin: number, end?: number): ArrayBuffer;
}

/**
* Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays.
*/
interface ArrayBufferTypes {
ArrayBuffer: ArrayBuffer;
}
type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes];

interface ArrayBufferConstructor {
readonly prototype: ArrayBuffer;
new(byteLength: number): ArrayBuffer;
isView(arg: any): arg is ArrayBufferView;
}
declare var ArrayBuffer: ArrayBufferConstructor;

interface ArrayBufferView {
/**
* The ArrayBuffer instance referenced by the array.
*/
buffer: ArrayBufferLike;

/**
* The length in bytes of the array.
*/
byteLength: number;

/**
* The offset in bytes of the array.
*/
byteOffset: number;
}
12 changes: 12 additions & 0 deletions src/lib/es2009.boolean.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface Boolean {
/** Returns the primitive value of the specified object. */
valueOf(): boolean;
}

interface BooleanConstructor {
new(value?: any): Boolean;
<T>(value?: T): boolean;
readonly prototype: Boolean;
}

declare var Boolean: BooleanConstructor;
73 changes: 73 additions & 0 deletions src/lib/es2009.core.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
declare var NaN: number;
declare var Infinity: number;

/**
* Evaluates JavaScript code and executes it.
* @param x A String value that contains valid JavaScript code.
*/
declare function eval(x: string): any;

/**
* Converts a string to an integer.
* @param string A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in `string`.
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
* All other strings are considered decimal.
*/
declare function parseInt(string: string, radix?: number): number;

/**
* Converts a string to a floating-point number.
* @param string A string that contains a floating-point number.
*/
declare function parseFloat(string: string): number;

/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).
* @param number A numeric value.
*/
declare function isNaN(number: number): boolean;

/**
* Determines whether a supplied number is finite.
* @param number Any numeric value.
*/
declare function isFinite(number: number): boolean;

/**
* Gets the unencoded version of an encoded Uniform Resource Identifier (URI).
* @param encodedURI A value representing an encoded URI.
*/
declare function decodeURI(encodedURI: string): string;

/**
* Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
* @param encodedURIComponent A value representing an encoded URI component.
*/
declare function decodeURIComponent(encodedURIComponent: string): string;

/**
* Encodes a text string as a valid Uniform Resource Identifier (URI)
* @param uri A value representing an unencoded URI.
*/
declare function encodeURI(uri: string): string;

/**
* Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
* @param uriComponent A value representing an unencoded URI component.
*/
declare function encodeURIComponent(uriComponent: string | number | boolean): string;

/**
* Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
* @deprecated A legacy feature for browser compatibility
* @param string A string value
*/
declare function escape(string: string): string;

/**
* Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
* @deprecated A legacy feature for browser compatibility
* @param string A string value
*/
declare function unescape(string: string): string;
135 changes: 135 additions & 0 deletions src/lib/es2009.dataview.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/// <reference lib="es2009.arraybuffer" />

interface DataView {
readonly buffer: ArrayBuffer;
readonly byteLength: number;
readonly byteOffset: number;
/**
* Gets the Float32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getFloat32(byteOffset: number, littleEndian?: boolean): number;

/**
* Gets the Float64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getFloat64(byteOffset: number, littleEndian?: boolean): number;

/**
* Gets the Int8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt8(byteOffset: number): number;

/**
* Gets the Int16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getInt16(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getInt32(byteOffset: number, littleEndian?: boolean): number;

/**
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint8(byteOffset: number): number;

/**
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getUint16(byteOffset: number, littleEndian?: boolean): number;

/**
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getUint32(byteOffset: number, littleEndian?: boolean): number;

/**
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;

/**
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;

/**
* Stores an Int8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setInt8(byteOffset: number, value: number): void;

/**
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;

/**
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;

/**
* Stores an Uint8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setUint8(byteOffset: number, value: number): void;

/**
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;

/**
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
}

interface DataViewConstructor {
readonly prototype: DataView;
new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;
}
declare var DataView: DataViewConstructor;
Loading