Fix inconsistent 'readonly' modifiers in lib files

This commit is contained in:
Anders Hejlsberg
2024-04-22 08:18:47 -07:00
parent f8fa8b2726
commit 453d778de0
16 changed files with 68 additions and 68 deletions

View File

@@ -1266,8 +1266,8 @@ interface PushSubscriptionOptionsInit {
}
interface QueuingStrategy<T = any> {
highWaterMark?: number;
size?: QueuingStrategySize<T>;
readonly highWaterMark?: number;
readonly size?: QueuingStrategySize<T>;
}
interface QueuingStrategyInit {
@@ -1276,7 +1276,7 @@ interface QueuingStrategyInit {
*
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
*/
highWaterMark: number;
readonly highWaterMark: number;
}
interface RTCAnswerOptions extends RTCOfferAnswerOptions {
@@ -5965,9 +5965,9 @@ interface DOMException extends Error {
*/
readonly code: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
readonly message: string;
message: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
readonly name: string;
name: string;
readonly INDEX_SIZE_ERR: 1;
readonly DOMSTRING_SIZE_ERR: 2;
readonly HIERARCHY_REQUEST_ERR: 3;
@@ -18625,7 +18625,7 @@ interface ReadableStream<R = any> {
declare var ReadableStream: {
prototype: ReadableStream;
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
new(underlyingSource: UnderlyingByteSource, strategy?: { readonly highWaterMark?: number }): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
};
@@ -19365,7 +19365,7 @@ interface SVGElementEventMap extends ElementEventMap, GlobalEventHandlersEventMa
*/
interface SVGElement extends Element, ElementCSSInlineStyle, GlobalEventHandlers, HTMLOrSVGElement {
/** @deprecated */
readonly className: any;
className: any;
readonly ownerSVGElement: SVGSVGElement | null;
readonly viewportElement: SVGElement | null;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;

View File

@@ -30,7 +30,7 @@ interface Map<K, V> {
interface MapConstructor {
new (): Map<any, any>;
new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
readonly prototype: Map<any, any>;
prototype: Map<any, any>;
}
declare var Map: MapConstructor;
@@ -64,7 +64,7 @@ interface WeakMap<K extends WeakKey, V> {
interface WeakMapConstructor {
new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
readonly prototype: WeakMap<WeakKey, any>;
prototype: WeakMap<WeakKey, any>;
}
declare var WeakMap: WeakMapConstructor;
@@ -96,7 +96,7 @@ interface Set<T> {
interface SetConstructor {
new <T = any>(values?: readonly T[] | null): Set<T>;
readonly prototype: Set<any>;
prototype: Set<any>;
}
declare var Set: SetConstructor;
@@ -124,6 +124,6 @@ interface WeakSet<T extends WeakKey> {
interface WeakSetConstructor {
new <T extends WeakKey = WeakKey>(values?: readonly T[] | null): WeakSet<T>;
readonly prototype: WeakSet<WeakKey>;
prototype: WeakSet<WeakKey>;
}
declare var WeakSet: WeakSetConstructor;

View File

@@ -30,7 +30,7 @@ interface GeneratorFunction {
/**
* A reference to the prototype.
*/
readonly prototype: Generator;
prototype: Generator;
}
interface GeneratorFunctionConstructor {
@@ -55,5 +55,5 @@ interface GeneratorFunctionConstructor {
/**
* A reference to the prototype.
*/
readonly prototype: GeneratorFunction;
prototype: GeneratorFunction;
}

View File

@@ -2,7 +2,7 @@ interface PromiseConstructor {
/**
* A reference to the prototype.
*/
readonly prototype: Promise<any>;
prototype: Promise<any>;
/**
* Creates a new Promise.

View File

@@ -2,7 +2,7 @@ interface SymbolConstructor {
/**
* A reference to the prototype.
*/
readonly prototype: Symbol;
prototype: Symbol;
/**
* Returns a new unique Symbol value.

View File

@@ -3,7 +3,7 @@ interface ObjectConstructor {
* Returns an array of values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[];
values<T>(o: { readonly [s: string]: T; } | ArrayLike<T>): T[];
/**
* Returns an array of values of the enumerable properties of an object
@@ -15,7 +15,7 @@ interface ObjectConstructor {
* Returns an array of key/values of the enumerable properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
entries<T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][];
entries<T>(o: { readonly [s: string]: T; } | ArrayLike<T>): [string, T][];
/**
* Returns an array of key/values of the enumerable properties of an object

View File

@@ -16,7 +16,7 @@ interface SharedArrayBuffer {
}
interface SharedArrayBufferConstructor {
readonly prototype: SharedArrayBuffer;
prototype: SharedArrayBuffer;
new (byteLength: number): SharedArrayBuffer;
}
declare var SharedArrayBuffer: SharedArrayBufferConstructor;

View File

@@ -30,7 +30,7 @@ interface AsyncGeneratorFunction {
/**
* A reference to the prototype.
*/
readonly prototype: AsyncGenerator;
prototype: AsyncGenerator;
}
interface AsyncGeneratorFunctionConstructor {
@@ -55,5 +55,5 @@ interface AsyncGeneratorFunctionConstructor {
/**
* A reference to the prototype.
*/
readonly prototype: AsyncGeneratorFunction;
prototype: AsyncGeneratorFunction;
}

View File

@@ -32,7 +32,7 @@ declare namespace Intl {
interface PluralRulesConstructor {
new (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules;
(locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules;
supportedLocalesOf(locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
supportedLocalesOf(locales: string | readonly string[], options?: { readonly localeMatcher?: "lookup" | "best fit"; }): string[];
}
const PluralRules: PluralRulesConstructor;

View File

@@ -104,7 +104,7 @@ interface BigInt {
interface BigIntConstructor {
(value: bigint | boolean | number | string): bigint;
readonly prototype: BigInt;
prototype: BigInt;
/**
* Interprets the low bits of a BigInt as a 2's-complement signed integer.
@@ -370,7 +370,7 @@ interface BigInt64Array {
}
interface BigInt64ArrayConstructor {
readonly prototype: BigInt64Array;
prototype: BigInt64Array;
new (length?: number): BigInt64Array;
new (array: Iterable<bigint>): BigInt64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
@@ -642,7 +642,7 @@ interface BigUint64Array {
}
interface BigUint64ArrayConstructor {
readonly prototype: BigUint64Array;
prototype: BigUint64Array;
new (length?: number): BigUint64Array;
new (array: Iterable<bigint>): BigUint64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;

View File

@@ -426,7 +426,7 @@ declare namespace Intl {
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
*/
supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
supportedLocalesOf(locales?: LocalesArgument, options?: { readonly localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
};
interface CollatorConstructor {

View File

@@ -5,7 +5,7 @@ interface AggregateError extends Error {
interface AggregateErrorConstructor {
new (errors: Iterable<any>, message?: string): AggregateError;
(errors: Iterable<any>, message?: string): AggregateError;
readonly prototype: AggregateError;
prototype: AggregateError;
}
declare var AggregateError: AggregateErrorConstructor;

View File

@@ -10,7 +10,7 @@ interface WeakRef<T extends WeakKey> {
}
interface WeakRefConstructor {
readonly prototype: WeakRef<any>;
prototype: WeakRef<any>;
/**
* Creates a WeakRef instance for the given target value.
@@ -46,7 +46,7 @@ interface FinalizationRegistry<T> {
}
interface FinalizationRegistryConstructor {
readonly prototype: FinalizationRegistry<any>;
prototype: FinalizationRegistry<any>;
/**
* Creates a finalization registry with an associated cleanup callback

62
src/lib/es5.d.ts vendored
View File

@@ -140,7 +140,7 @@ interface ObjectConstructor {
(value: any): any;
/** A reference to the prototype for a class of objects. */
readonly prototype: Object;
prototype: Object;
/**
* Returns the prototype of an object.
@@ -295,7 +295,7 @@ interface FunctionConstructor {
*/
new (...args: string[]): Function;
(...args: string[]): Function;
readonly prototype: Function;
prototype: Function;
}
declare var Function: FunctionConstructor;
@@ -516,7 +516,7 @@ interface String {
interface StringConstructor {
new (value?: any): String;
(value?: any): string;
readonly prototype: String;
prototype: String;
fromCharCode(...codes: number[]): string;
}
@@ -533,7 +533,7 @@ interface Boolean {
interface BooleanConstructor {
new (value?: any): Boolean;
<T>(value?: T): boolean;
readonly prototype: Boolean;
prototype: Boolean;
}
declare var Boolean: BooleanConstructor;
@@ -570,7 +570,7 @@ interface Number {
interface NumberConstructor {
new (value?: any): Number;
(value?: any): number;
readonly prototype: Number;
prototype: Number;
/** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */
readonly MAX_VALUE: number;
@@ -919,7 +919,7 @@ interface DateConstructor {
*/
new (year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;
(): string;
readonly prototype: Date;
prototype: Date;
/**
* Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
* @param s A date string
@@ -1063,7 +1063,7 @@ interface Error {
interface ErrorConstructor {
new (message?: string): Error;
(message?: string): Error;
readonly prototype: Error;
prototype: Error;
}
declare var Error: ErrorConstructor;
@@ -1074,7 +1074,7 @@ interface EvalError extends Error {
interface EvalErrorConstructor extends ErrorConstructor {
new (message?: string): EvalError;
(message?: string): EvalError;
readonly prototype: EvalError;
prototype: EvalError;
}
declare var EvalError: EvalErrorConstructor;
@@ -1085,7 +1085,7 @@ interface RangeError extends Error {
interface RangeErrorConstructor extends ErrorConstructor {
new (message?: string): RangeError;
(message?: string): RangeError;
readonly prototype: RangeError;
prototype: RangeError;
}
declare var RangeError: RangeErrorConstructor;
@@ -1096,7 +1096,7 @@ interface ReferenceError extends Error {
interface ReferenceErrorConstructor extends ErrorConstructor {
new (message?: string): ReferenceError;
(message?: string): ReferenceError;
readonly prototype: ReferenceError;
prototype: ReferenceError;
}
declare var ReferenceError: ReferenceErrorConstructor;
@@ -1107,7 +1107,7 @@ interface SyntaxError extends Error {
interface SyntaxErrorConstructor extends ErrorConstructor {
new (message?: string): SyntaxError;
(message?: string): SyntaxError;
readonly prototype: SyntaxError;
prototype: SyntaxError;
}
declare var SyntaxError: SyntaxErrorConstructor;
@@ -1118,7 +1118,7 @@ interface TypeError extends Error {
interface TypeErrorConstructor extends ErrorConstructor {
new (message?: string): TypeError;
(message?: string): TypeError;
readonly prototype: TypeError;
prototype: TypeError;
}
declare var TypeError: TypeErrorConstructor;
@@ -1129,7 +1129,7 @@ interface URIError extends Error {
interface URIErrorConstructor extends ErrorConstructor {
new (message?: string): URIError;
(message?: string): URIError;
readonly prototype: URIError;
prototype: URIError;
}
declare var URIError: URIErrorConstructor;
@@ -1493,7 +1493,7 @@ interface ArrayConstructor {
<T>(arrayLength: number): T[];
<T>(...items: T[]): T[];
isArray(arg: any): arg is any[];
readonly prototype: any[];
prototype: any[];
}
declare var Array: ArrayConstructor;
@@ -1695,7 +1695,7 @@ interface ArrayBufferTypes {
type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes];
interface ArrayBufferConstructor {
readonly prototype: ArrayBuffer;
prototype: ArrayBuffer;
new (byteLength: number): ArrayBuffer;
isView(arg: any): arg is ArrayBufferView;
}
@@ -1705,17 +1705,17 @@ interface ArrayBufferView {
/**
* The ArrayBuffer instance referenced by the array.
*/
buffer: ArrayBufferLike;
readonly buffer: ArrayBufferLike;
/**
* The length in bytes of the array.
*/
byteLength: number;
readonly byteLength: number;
/**
* The offset in bytes of the array.
*/
byteOffset: number;
readonly byteOffset: number;
}
interface DataView {
@@ -1847,8 +1847,8 @@ interface DataView {
}
interface DataViewConstructor {
readonly prototype: DataView;
new (buffer: ArrayBufferLike & { BYTES_PER_ELEMENT?: never; }, byteOffset?: number, byteLength?: number): DataView;
prototype: DataView;
new (buffer: ArrayBufferLike & { readonly BYTES_PER_ELEMENT?: never; }, byteOffset?: number, byteLength?: number): DataView;
}
declare var DataView: DataViewConstructor;
@@ -2100,7 +2100,7 @@ interface Int8Array {
[index: number]: number;
}
interface Int8ArrayConstructor {
readonly prototype: Int8Array;
prototype: Int8Array;
new (length: number): Int8Array;
new (array: ArrayLike<number> | ArrayBufferLike): Int8Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;
@@ -2381,7 +2381,7 @@ interface Uint8Array {
}
interface Uint8ArrayConstructor {
readonly prototype: Uint8Array;
prototype: Uint8Array;
new (length: number): Uint8Array;
new (array: ArrayLike<number> | ArrayBufferLike): Uint8Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;
@@ -2662,7 +2662,7 @@ interface Uint8ClampedArray {
}
interface Uint8ClampedArrayConstructor {
readonly prototype: Uint8ClampedArray;
prototype: Uint8ClampedArray;
new (length: number): Uint8ClampedArray;
new (array: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;
@@ -2942,7 +2942,7 @@ interface Int16Array {
}
interface Int16ArrayConstructor {
readonly prototype: Int16Array;
prototype: Int16Array;
new (length: number): Int16Array;
new (array: ArrayLike<number> | ArrayBufferLike): Int16Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;
@@ -3223,7 +3223,7 @@ interface Uint16Array {
}
interface Uint16ArrayConstructor {
readonly prototype: Uint16Array;
prototype: Uint16Array;
new (length: number): Uint16Array;
new (array: ArrayLike<number> | ArrayBufferLike): Uint16Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;
@@ -3503,7 +3503,7 @@ interface Int32Array {
}
interface Int32ArrayConstructor {
readonly prototype: Int32Array;
prototype: Int32Array;
new (length: number): Int32Array;
new (array: ArrayLike<number> | ArrayBufferLike): Int32Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;
@@ -3783,7 +3783,7 @@ interface Uint32Array {
}
interface Uint32ArrayConstructor {
readonly prototype: Uint32Array;
prototype: Uint32Array;
new (length: number): Uint32Array;
new (array: ArrayLike<number> | ArrayBufferLike): Uint32Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;
@@ -4064,7 +4064,7 @@ interface Float32Array {
}
interface Float32ArrayConstructor {
readonly prototype: Float32Array;
prototype: Float32Array;
new (length: number): Float32Array;
new (array: ArrayLike<number> | ArrayBufferLike): Float32Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;
@@ -4345,7 +4345,7 @@ interface Float64Array {
}
interface Float64ArrayConstructor {
readonly prototype: Float64Array;
prototype: Float64Array;
new (length: number): Float64Array;
new (array: ArrayLike<number> | ArrayBufferLike): Float64Array;
new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;
@@ -4472,7 +4472,7 @@ declare namespace Intl {
new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
(locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
readonly prototype: NumberFormat;
prototype: NumberFormat;
}
var NumberFormat: NumberFormatConstructor;
@@ -4519,7 +4519,7 @@ declare namespace Intl {
new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
readonly prototype: DateTimeFormat;
prototype: DateTimeFormat;
}
var DateTimeFormat: DateTimeFormatConstructor;

View File

@@ -28,7 +28,7 @@ interface SuppressedError extends Error {
interface SuppressedErrorConstructor {
new (error: any, suppressed: any, message?: string): SuppressedError;
(error: any, suppressed: any, message?: string): SuppressedError;
readonly prototype: SuppressedError;
prototype: SuppressedError;
}
declare var SuppressedError: SuppressedErrorConstructor;
@@ -95,7 +95,7 @@ interface DisposableStack {
interface DisposableStackConstructor {
new (): DisposableStack;
readonly prototype: DisposableStack;
prototype: DisposableStack;
}
declare var DisposableStack: DisposableStackConstructor;
@@ -162,6 +162,6 @@ interface AsyncDisposableStack {
interface AsyncDisposableStackConstructor {
new (): AsyncDisposableStack;
readonly prototype: AsyncDisposableStack;
prototype: AsyncDisposableStack;
}
declare var AsyncDisposableStack: AsyncDisposableStackConstructor;

View File

@@ -490,8 +490,8 @@ interface PushSubscriptionOptionsInit {
}
interface QueuingStrategy<T = any> {
highWaterMark?: number;
size?: QueuingStrategySize<T>;
readonly highWaterMark?: number;
readonly size?: QueuingStrategySize<T>;
}
interface QueuingStrategyInit {
@@ -500,7 +500,7 @@ interface QueuingStrategyInit {
*
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
*/
highWaterMark: number;
readonly highWaterMark: number;
}
interface RTCEncodedAudioFrameMetadata {
@@ -1879,9 +1879,9 @@ interface DOMException extends Error {
*/
readonly code: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
readonly message: string;
message: string;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
readonly name: string;
name: string;
readonly INDEX_SIZE_ERR: 1;
readonly DOMSTRING_SIZE_ERR: 2;
readonly HIERARCHY_REQUEST_ERR: 3;
@@ -4840,7 +4840,7 @@ interface ReadableStream<R = any> {
declare var ReadableStream: {
prototype: ReadableStream;
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
new(underlyingSource: UnderlyingByteSource, strategy?: { readonly highWaterMark?: number }): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
};