@typescript-deploys/pr-build 5.5.0-pr-58264-13 → 5.5.0-pr-58296-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/lib.dom.d.ts CHANGED
@@ -1293,8 +1293,8 @@ interface PushSubscriptionOptionsInit {
1293
1293
  }
1294
1294
 
1295
1295
  interface QueuingStrategy<T = any> {
1296
- highWaterMark?: number;
1297
- size?: QueuingStrategySize<T>;
1296
+ readonly highWaterMark?: number;
1297
+ readonly size?: QueuingStrategySize<T>;
1298
1298
  }
1299
1299
 
1300
1300
  interface QueuingStrategyInit {
@@ -1303,7 +1303,7 @@ interface QueuingStrategyInit {
1303
1303
  *
1304
1304
  * 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.
1305
1305
  */
1306
- highWaterMark: number;
1306
+ readonly highWaterMark: number;
1307
1307
  }
1308
1308
 
1309
1309
  interface RTCAnswerOptions extends RTCOfferAnswerOptions {
@@ -6059,9 +6059,9 @@ interface DOMException extends Error {
6059
6059
  */
6060
6060
  readonly code: number;
6061
6061
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
6062
- readonly message: string;
6062
+ message: string;
6063
6063
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
6064
- readonly name: string;
6064
+ name: string;
6065
6065
  readonly INDEX_SIZE_ERR: 1;
6066
6066
  readonly DOMSTRING_SIZE_ERR: 2;
6067
6067
  readonly HIERARCHY_REQUEST_ERR: 3;
@@ -18811,7 +18811,7 @@ interface ReadableStream<R = any> {
18811
18811
 
18812
18812
  declare var ReadableStream: {
18813
18813
  prototype: ReadableStream;
18814
- new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
18814
+ new(underlyingSource: UnderlyingByteSource, strategy?: { readonly highWaterMark?: number }): ReadableStream<Uint8Array>;
18815
18815
  new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
18816
18816
  new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
18817
18817
  };
@@ -19551,7 +19551,7 @@ interface SVGElementEventMap extends ElementEventMap, GlobalEventHandlersEventMa
19551
19551
  */
19552
19552
  interface SVGElement extends Element, ElementCSSInlineStyle, GlobalEventHandlers, HTMLOrSVGElement {
19553
19553
  /** @deprecated */
19554
- readonly className: any;
19554
+ className: any;
19555
19555
  readonly ownerSVGElement: SVGSVGElement | null;
19556
19556
  readonly viewportElement: SVGElement | null;
19557
19557
  addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -48,7 +48,7 @@ interface Map<K, V> {
48
48
  interface MapConstructor {
49
49
  new (): Map<any, any>;
50
50
  new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>;
51
- readonly prototype: Map<any, any>;
51
+ prototype: Map<any, any>;
52
52
  }
53
53
  declare var Map: MapConstructor;
54
54
 
@@ -82,7 +82,7 @@ interface WeakMap<K extends WeakKey, V> {
82
82
 
83
83
  interface WeakMapConstructor {
84
84
  new <K extends WeakKey = WeakKey, V = any>(entries?: readonly (readonly [K, V])[] | null): WeakMap<K, V>;
85
- readonly prototype: WeakMap<WeakKey, any>;
85
+ prototype: WeakMap<WeakKey, any>;
86
86
  }
87
87
  declare var WeakMap: WeakMapConstructor;
88
88
 
@@ -114,7 +114,7 @@ interface Set<T> {
114
114
 
115
115
  interface SetConstructor {
116
116
  new <T = any>(values?: readonly T[] | null): Set<T>;
117
- readonly prototype: Set<any>;
117
+ prototype: Set<any>;
118
118
  }
119
119
  declare var Set: SetConstructor;
120
120
 
@@ -142,6 +142,6 @@ interface WeakSet<T extends WeakKey> {
142
142
 
143
143
  interface WeakSetConstructor {
144
144
  new <T extends WeakKey = WeakKey>(values?: readonly T[] | null): WeakSet<T>;
145
- readonly prototype: WeakSet<WeakKey>;
145
+ prototype: WeakSet<WeakKey>;
146
146
  }
147
147
  declare var WeakSet: WeakSetConstructor;
@@ -48,7 +48,7 @@ interface GeneratorFunction {
48
48
  /**
49
49
  * A reference to the prototype.
50
50
  */
51
- readonly prototype: Generator;
51
+ prototype: Generator;
52
52
  }
53
53
 
54
54
  interface GeneratorFunctionConstructor {
@@ -73,5 +73,5 @@ interface GeneratorFunctionConstructor {
73
73
  /**
74
74
  * A reference to the prototype.
75
75
  */
76
- readonly prototype: GeneratorFunction;
76
+ prototype: GeneratorFunction;
77
77
  }
@@ -20,7 +20,7 @@ interface PromiseConstructor {
20
20
  /**
21
21
  * A reference to the prototype.
22
22
  */
23
- readonly prototype: Promise<any>;
23
+ prototype: Promise<any>;
24
24
 
25
25
  /**
26
26
  * Creates a new Promise.
@@ -20,7 +20,7 @@ interface SymbolConstructor {
20
20
  /**
21
21
  * A reference to the prototype.
22
22
  */
23
- readonly prototype: Symbol;
23
+ prototype: Symbol;
24
24
 
25
25
  /**
26
26
  * Returns a new unique Symbol value.
@@ -21,7 +21,7 @@ interface ObjectConstructor {
21
21
  * Returns an array of values of the enumerable properties of an object
22
22
  * @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.
23
23
  */
24
- values<T>(o: { [s: string]: T; } | ArrayLike<T>): T[];
24
+ values<T>(o: { readonly [s: string]: T; } | ArrayLike<T>): T[];
25
25
 
26
26
  /**
27
27
  * Returns an array of values of the enumerable properties of an object
@@ -33,7 +33,7 @@ interface ObjectConstructor {
33
33
  * Returns an array of key/values of the enumerable properties of an object
34
34
  * @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.
35
35
  */
36
- entries<T>(o: { [s: string]: T; } | ArrayLike<T>): [string, T][];
36
+ entries<T>(o: { readonly [s: string]: T; } | ArrayLike<T>): [string, T][];
37
37
 
38
38
  /**
39
39
  * Returns an array of key/values of the enumerable properties of an object
@@ -34,7 +34,7 @@ interface SharedArrayBuffer {
34
34
  }
35
35
 
36
36
  interface SharedArrayBufferConstructor {
37
- readonly prototype: SharedArrayBuffer;
37
+ prototype: SharedArrayBuffer;
38
38
  new (byteLength: number): SharedArrayBuffer;
39
39
  }
40
40
  declare var SharedArrayBuffer: SharedArrayBufferConstructor;
@@ -48,7 +48,7 @@ interface AsyncGeneratorFunction {
48
48
  /**
49
49
  * A reference to the prototype.
50
50
  */
51
- readonly prototype: AsyncGenerator;
51
+ prototype: AsyncGenerator;
52
52
  }
53
53
 
54
54
  interface AsyncGeneratorFunctionConstructor {
@@ -73,5 +73,5 @@ interface AsyncGeneratorFunctionConstructor {
73
73
  /**
74
74
  * A reference to the prototype.
75
75
  */
76
- readonly prototype: AsyncGeneratorFunction;
76
+ prototype: AsyncGeneratorFunction;
77
77
  }
@@ -50,7 +50,7 @@ declare namespace Intl {
50
50
  interface PluralRulesConstructor {
51
51
  new (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules;
52
52
  (locales?: string | readonly string[], options?: PluralRulesOptions): PluralRules;
53
- supportedLocalesOf(locales: string | readonly string[], options?: { localeMatcher?: "lookup" | "best fit"; }): string[];
53
+ supportedLocalesOf(locales: string | readonly string[], options?: { readonly localeMatcher?: "lookup" | "best fit"; }): string[];
54
54
  }
55
55
 
56
56
  const PluralRules: PluralRulesConstructor;
@@ -122,7 +122,7 @@ interface BigInt {
122
122
 
123
123
  interface BigIntConstructor {
124
124
  (value: bigint | boolean | number | string): bigint;
125
- readonly prototype: BigInt;
125
+ prototype: BigInt;
126
126
 
127
127
  /**
128
128
  * Interprets the low bits of a BigInt as a 2's-complement signed integer.
@@ -388,7 +388,7 @@ interface BigInt64Array {
388
388
  }
389
389
 
390
390
  interface BigInt64ArrayConstructor {
391
- readonly prototype: BigInt64Array;
391
+ prototype: BigInt64Array;
392
392
  new (length?: number): BigInt64Array;
393
393
  new (array: Iterable<bigint>): BigInt64Array;
394
394
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigInt64Array;
@@ -660,7 +660,7 @@ interface BigUint64Array {
660
660
  }
661
661
 
662
662
  interface BigUint64ArrayConstructor {
663
- readonly prototype: BigUint64Array;
663
+ prototype: BigUint64Array;
664
664
  new (length?: number): BigUint64Array;
665
665
  new (array: Iterable<bigint>): BigUint64Array;
666
666
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): BigUint64Array;
@@ -444,7 +444,7 @@ declare namespace Intl {
444
444
  *
445
445
  * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/supportedLocalesOf).
446
446
  */
447
- supportedLocalesOf(locales?: LocalesArgument, options?: { localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
447
+ supportedLocalesOf(locales?: LocalesArgument, options?: { readonly localeMatcher?: RelativeTimeFormatLocaleMatcher; }): UnicodeBCP47LocaleIdentifier[];
448
448
  };
449
449
 
450
450
  interface CollatorConstructor {
@@ -23,7 +23,7 @@ interface AggregateError extends Error {
23
23
  interface AggregateErrorConstructor {
24
24
  new (errors: Iterable<any>, message?: string): AggregateError;
25
25
  (errors: Iterable<any>, message?: string): AggregateError;
26
- readonly prototype: AggregateError;
26
+ prototype: AggregateError;
27
27
  }
28
28
 
29
29
  declare var AggregateError: AggregateErrorConstructor;
@@ -28,7 +28,7 @@ interface WeakRef<T extends WeakKey> {
28
28
  }
29
29
 
30
30
  interface WeakRefConstructor {
31
- readonly prototype: WeakRef<any>;
31
+ prototype: WeakRef<any>;
32
32
 
33
33
  /**
34
34
  * Creates a WeakRef instance for the given target value.
@@ -64,7 +64,7 @@ interface FinalizationRegistry<T> {
64
64
  }
65
65
 
66
66
  interface FinalizationRegistryConstructor {
67
- readonly prototype: FinalizationRegistry<any>;
67
+ prototype: FinalizationRegistry<any>;
68
68
 
69
69
  /**
70
70
  * Creates a finalization registry with an associated cleanup callback
package/lib/lib.es5.d.ts CHANGED
@@ -158,7 +158,7 @@ interface ObjectConstructor {
158
158
  (value: any): any;
159
159
 
160
160
  /** A reference to the prototype for a class of objects. */
161
- readonly prototype: Object;
161
+ prototype: Object;
162
162
 
163
163
  /**
164
164
  * Returns the prototype of an object.
@@ -313,7 +313,7 @@ interface FunctionConstructor {
313
313
  */
314
314
  new (...args: string[]): Function;
315
315
  (...args: string[]): Function;
316
- readonly prototype: Function;
316
+ prototype: Function;
317
317
  }
318
318
 
319
319
  declare var Function: FunctionConstructor;
@@ -534,7 +534,7 @@ interface String {
534
534
  interface StringConstructor {
535
535
  new (value?: any): String;
536
536
  (value?: any): string;
537
- readonly prototype: String;
537
+ prototype: String;
538
538
  fromCharCode(...codes: number[]): string;
539
539
  }
540
540
 
@@ -551,7 +551,7 @@ interface Boolean {
551
551
  interface BooleanConstructor {
552
552
  new (value?: any): Boolean;
553
553
  <T>(value?: T): boolean;
554
- readonly prototype: Boolean;
554
+ prototype: Boolean;
555
555
  }
556
556
 
557
557
  declare var Boolean: BooleanConstructor;
@@ -588,7 +588,7 @@ interface Number {
588
588
  interface NumberConstructor {
589
589
  new (value?: any): Number;
590
590
  (value?: any): number;
591
- readonly prototype: Number;
591
+ prototype: Number;
592
592
 
593
593
  /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */
594
594
  readonly MAX_VALUE: number;
@@ -937,7 +937,7 @@ interface DateConstructor {
937
937
  */
938
938
  new (year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;
939
939
  (): string;
940
- readonly prototype: Date;
940
+ prototype: Date;
941
941
  /**
942
942
  * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
943
943
  * @param s A date string
@@ -1081,7 +1081,7 @@ interface Error {
1081
1081
  interface ErrorConstructor {
1082
1082
  new (message?: string): Error;
1083
1083
  (message?: string): Error;
1084
- readonly prototype: Error;
1084
+ prototype: Error;
1085
1085
  }
1086
1086
 
1087
1087
  declare var Error: ErrorConstructor;
@@ -1092,7 +1092,7 @@ interface EvalError extends Error {
1092
1092
  interface EvalErrorConstructor extends ErrorConstructor {
1093
1093
  new (message?: string): EvalError;
1094
1094
  (message?: string): EvalError;
1095
- readonly prototype: EvalError;
1095
+ prototype: EvalError;
1096
1096
  }
1097
1097
 
1098
1098
  declare var EvalError: EvalErrorConstructor;
@@ -1103,7 +1103,7 @@ interface RangeError extends Error {
1103
1103
  interface RangeErrorConstructor extends ErrorConstructor {
1104
1104
  new (message?: string): RangeError;
1105
1105
  (message?: string): RangeError;
1106
- readonly prototype: RangeError;
1106
+ prototype: RangeError;
1107
1107
  }
1108
1108
 
1109
1109
  declare var RangeError: RangeErrorConstructor;
@@ -1114,7 +1114,7 @@ interface ReferenceError extends Error {
1114
1114
  interface ReferenceErrorConstructor extends ErrorConstructor {
1115
1115
  new (message?: string): ReferenceError;
1116
1116
  (message?: string): ReferenceError;
1117
- readonly prototype: ReferenceError;
1117
+ prototype: ReferenceError;
1118
1118
  }
1119
1119
 
1120
1120
  declare var ReferenceError: ReferenceErrorConstructor;
@@ -1125,7 +1125,7 @@ interface SyntaxError extends Error {
1125
1125
  interface SyntaxErrorConstructor extends ErrorConstructor {
1126
1126
  new (message?: string): SyntaxError;
1127
1127
  (message?: string): SyntaxError;
1128
- readonly prototype: SyntaxError;
1128
+ prototype: SyntaxError;
1129
1129
  }
1130
1130
 
1131
1131
  declare var SyntaxError: SyntaxErrorConstructor;
@@ -1136,7 +1136,7 @@ interface TypeError extends Error {
1136
1136
  interface TypeErrorConstructor extends ErrorConstructor {
1137
1137
  new (message?: string): TypeError;
1138
1138
  (message?: string): TypeError;
1139
- readonly prototype: TypeError;
1139
+ prototype: TypeError;
1140
1140
  }
1141
1141
 
1142
1142
  declare var TypeError: TypeErrorConstructor;
@@ -1147,7 +1147,7 @@ interface URIError extends Error {
1147
1147
  interface URIErrorConstructor extends ErrorConstructor {
1148
1148
  new (message?: string): URIError;
1149
1149
  (message?: string): URIError;
1150
- readonly prototype: URIError;
1150
+ prototype: URIError;
1151
1151
  }
1152
1152
 
1153
1153
  declare var URIError: URIErrorConstructor;
@@ -1511,7 +1511,7 @@ interface ArrayConstructor {
1511
1511
  <T>(arrayLength: number): T[];
1512
1512
  <T>(...items: T[]): T[];
1513
1513
  isArray(arg: any): arg is any[];
1514
- readonly prototype: any[];
1514
+ prototype: any[];
1515
1515
  }
1516
1516
 
1517
1517
  declare var Array: ArrayConstructor;
@@ -1713,7 +1713,7 @@ interface ArrayBufferTypes {
1713
1713
  type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes];
1714
1714
 
1715
1715
  interface ArrayBufferConstructor {
1716
- readonly prototype: ArrayBuffer;
1716
+ prototype: ArrayBuffer;
1717
1717
  new (byteLength: number): ArrayBuffer;
1718
1718
  isView(arg: any): arg is ArrayBufferView;
1719
1719
  }
@@ -1723,17 +1723,17 @@ interface ArrayBufferView {
1723
1723
  /**
1724
1724
  * The ArrayBuffer instance referenced by the array.
1725
1725
  */
1726
- buffer: ArrayBufferLike;
1726
+ readonly buffer: ArrayBufferLike;
1727
1727
 
1728
1728
  /**
1729
1729
  * The length in bytes of the array.
1730
1730
  */
1731
- byteLength: number;
1731
+ readonly byteLength: number;
1732
1732
 
1733
1733
  /**
1734
1734
  * The offset in bytes of the array.
1735
1735
  */
1736
- byteOffset: number;
1736
+ readonly byteOffset: number;
1737
1737
  }
1738
1738
 
1739
1739
  interface DataView {
@@ -1865,8 +1865,8 @@ interface DataView {
1865
1865
  }
1866
1866
 
1867
1867
  interface DataViewConstructor {
1868
- readonly prototype: DataView;
1869
- new (buffer: ArrayBufferLike & { BYTES_PER_ELEMENT?: never; }, byteOffset?: number, byteLength?: number): DataView;
1868
+ prototype: DataView;
1869
+ new (buffer: ArrayBufferLike & { readonly BYTES_PER_ELEMENT?: never; }, byteOffset?: number, byteLength?: number): DataView;
1870
1870
  }
1871
1871
  declare var DataView: DataViewConstructor;
1872
1872
 
@@ -2118,7 +2118,7 @@ interface Int8Array {
2118
2118
  [index: number]: number;
2119
2119
  }
2120
2120
  interface Int8ArrayConstructor {
2121
- readonly prototype: Int8Array;
2121
+ prototype: Int8Array;
2122
2122
  new (length: number): Int8Array;
2123
2123
  new (array: ArrayLike<number> | ArrayBufferLike): Int8Array;
2124
2124
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;
@@ -2399,7 +2399,7 @@ interface Uint8Array {
2399
2399
  }
2400
2400
 
2401
2401
  interface Uint8ArrayConstructor {
2402
- readonly prototype: Uint8Array;
2402
+ prototype: Uint8Array;
2403
2403
  new (length: number): Uint8Array;
2404
2404
  new (array: ArrayLike<number> | ArrayBufferLike): Uint8Array;
2405
2405
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;
@@ -2680,7 +2680,7 @@ interface Uint8ClampedArray {
2680
2680
  }
2681
2681
 
2682
2682
  interface Uint8ClampedArrayConstructor {
2683
- readonly prototype: Uint8ClampedArray;
2683
+ prototype: Uint8ClampedArray;
2684
2684
  new (length: number): Uint8ClampedArray;
2685
2685
  new (array: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray;
2686
2686
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;
@@ -2960,7 +2960,7 @@ interface Int16Array {
2960
2960
  }
2961
2961
 
2962
2962
  interface Int16ArrayConstructor {
2963
- readonly prototype: Int16Array;
2963
+ prototype: Int16Array;
2964
2964
  new (length: number): Int16Array;
2965
2965
  new (array: ArrayLike<number> | ArrayBufferLike): Int16Array;
2966
2966
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;
@@ -3241,7 +3241,7 @@ interface Uint16Array {
3241
3241
  }
3242
3242
 
3243
3243
  interface Uint16ArrayConstructor {
3244
- readonly prototype: Uint16Array;
3244
+ prototype: Uint16Array;
3245
3245
  new (length: number): Uint16Array;
3246
3246
  new (array: ArrayLike<number> | ArrayBufferLike): Uint16Array;
3247
3247
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;
@@ -3521,7 +3521,7 @@ interface Int32Array {
3521
3521
  }
3522
3522
 
3523
3523
  interface Int32ArrayConstructor {
3524
- readonly prototype: Int32Array;
3524
+ prototype: Int32Array;
3525
3525
  new (length: number): Int32Array;
3526
3526
  new (array: ArrayLike<number> | ArrayBufferLike): Int32Array;
3527
3527
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;
@@ -3801,7 +3801,7 @@ interface Uint32Array {
3801
3801
  }
3802
3802
 
3803
3803
  interface Uint32ArrayConstructor {
3804
- readonly prototype: Uint32Array;
3804
+ prototype: Uint32Array;
3805
3805
  new (length: number): Uint32Array;
3806
3806
  new (array: ArrayLike<number> | ArrayBufferLike): Uint32Array;
3807
3807
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;
@@ -4082,7 +4082,7 @@ interface Float32Array {
4082
4082
  }
4083
4083
 
4084
4084
  interface Float32ArrayConstructor {
4085
- readonly prototype: Float32Array;
4085
+ prototype: Float32Array;
4086
4086
  new (length: number): Float32Array;
4087
4087
  new (array: ArrayLike<number> | ArrayBufferLike): Float32Array;
4088
4088
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;
@@ -4363,7 +4363,7 @@ interface Float64Array {
4363
4363
  }
4364
4364
 
4365
4365
  interface Float64ArrayConstructor {
4366
- readonly prototype: Float64Array;
4366
+ prototype: Float64Array;
4367
4367
  new (length: number): Float64Array;
4368
4368
  new (array: ArrayLike<number> | ArrayBufferLike): Float64Array;
4369
4369
  new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;
@@ -4490,7 +4490,7 @@ declare namespace Intl {
4490
4490
  new (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
4491
4491
  (locales?: string | string[], options?: NumberFormatOptions): NumberFormat;
4492
4492
  supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
4493
- readonly prototype: NumberFormat;
4493
+ prototype: NumberFormat;
4494
4494
  }
4495
4495
 
4496
4496
  var NumberFormat: NumberFormatConstructor;
@@ -4537,7 +4537,7 @@ declare namespace Intl {
4537
4537
  new (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
4538
4538
  (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat;
4539
4539
  supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[];
4540
- readonly prototype: DateTimeFormat;
4540
+ prototype: DateTimeFormat;
4541
4541
  }
4542
4542
 
4543
4543
  var DateTimeFormat: DateTimeFormatConstructor;
@@ -46,7 +46,7 @@ interface SuppressedError extends Error {
46
46
  interface SuppressedErrorConstructor {
47
47
  new (error: any, suppressed: any, message?: string): SuppressedError;
48
48
  (error: any, suppressed: any, message?: string): SuppressedError;
49
- readonly prototype: SuppressedError;
49
+ prototype: SuppressedError;
50
50
  }
51
51
  declare var SuppressedError: SuppressedErrorConstructor;
52
52
 
@@ -113,7 +113,7 @@ interface DisposableStack {
113
113
 
114
114
  interface DisposableStackConstructor {
115
115
  new (): DisposableStack;
116
- readonly prototype: DisposableStack;
116
+ prototype: DisposableStack;
117
117
  }
118
118
  declare var DisposableStack: DisposableStackConstructor;
119
119
 
@@ -180,6 +180,6 @@ interface AsyncDisposableStack {
180
180
 
181
181
  interface AsyncDisposableStackConstructor {
182
182
  new (): AsyncDisposableStack;
183
- readonly prototype: AsyncDisposableStack;
183
+ prototype: AsyncDisposableStack;
184
184
  }
185
185
  declare var AsyncDisposableStack: AsyncDisposableStackConstructor;
@@ -508,8 +508,8 @@ interface PushSubscriptionOptionsInit {
508
508
  }
509
509
 
510
510
  interface QueuingStrategy<T = any> {
511
- highWaterMark?: number;
512
- size?: QueuingStrategySize<T>;
511
+ readonly highWaterMark?: number;
512
+ readonly size?: QueuingStrategySize<T>;
513
513
  }
514
514
 
515
515
  interface QueuingStrategyInit {
@@ -518,7 +518,7 @@ interface QueuingStrategyInit {
518
518
  *
519
519
  * 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.
520
520
  */
521
- highWaterMark: number;
521
+ readonly highWaterMark: number;
522
522
  }
523
523
 
524
524
  interface RTCEncodedAudioFrameMetadata {
@@ -1910,9 +1910,9 @@ interface DOMException extends Error {
1910
1910
  */
1911
1911
  readonly code: number;
1912
1912
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */
1913
- readonly message: string;
1913
+ message: string;
1914
1914
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */
1915
- readonly name: string;
1915
+ name: string;
1916
1916
  readonly INDEX_SIZE_ERR: 1;
1917
1917
  readonly DOMSTRING_SIZE_ERR: 2;
1918
1918
  readonly HIERARCHY_REQUEST_ERR: 3;
@@ -4871,7 +4871,7 @@ interface ReadableStream<R = any> {
4871
4871
 
4872
4872
  declare var ReadableStream: {
4873
4873
  prototype: ReadableStream;
4874
- new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
4874
+ new(underlyingSource: UnderlyingByteSource, strategy?: { readonly highWaterMark?: number }): ReadableStream<Uint8Array>;
4875
4875
  new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
4876
4876
  new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
4877
4877
  };
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240422`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240423`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6886,6 +6886,8 @@ var Diagnostics = {
6886
6886
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6887
6887
  Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
6888
6888
  One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
6889
+ Property_0_is_readonly_in_the_source_but_not_in_the_target: diag(4127, 1 /* Error */, "Property_0_is_readonly_in_the_source_but_not_in_the_target_4127", "Property '{0}' is 'readonly' in the source but not in the target."),
6890
+ _0_index_signature_is_readonly_in_the_source_but_not_in_the_target: diag(4128, 1 /* Error */, "_0_index_signature_is_readonly_in_the_source_but_not_in_the_target_4128", "'{0}' index signature is 'readonly' in the source but not in the target."),
6889
6891
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
6890
6892
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
6891
6893
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -7455,6 +7457,7 @@ var Diagnostics = {
7455
7457
  Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
7456
7458
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
7457
7459
  Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
7460
+ Ensure_that_readonly_properties_remain_read_only_in_type_relationships: diag(6720, 3 /* Message */, "Ensure_that_readonly_properties_remain_read_only_in_type_relationships_6720", "Ensure that 'readonly' properties remain read-only in type relationships."),
7458
7461
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
7459
7462
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
7460
7463
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
@@ -36213,6 +36216,15 @@ var commandOptionsWithoutBuild = [
36213
36216
  description: Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
36214
36217
  defaultValueDescription: false
36215
36218
  },
36219
+ {
36220
+ name: "enforceReadonly",
36221
+ type: "boolean",
36222
+ affectsSemanticDiagnostics: true,
36223
+ affectsBuildInfo: true,
36224
+ category: Diagnostics.Type_Checking,
36225
+ description: Diagnostics.Ensure_that_readonly_properties_remain_read_only_in_type_relationships,
36226
+ defaultValueDescription: false
36227
+ },
36216
36228
  // Module Resolution
36217
36229
  {
36218
36230
  name: "moduleResolution",
@@ -45281,6 +45293,7 @@ function createTypeChecker(host) {
45281
45293
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
45282
45294
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
45283
45295
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
45296
+ var enforceReadonly = compilerOptions.enforceReadonly;
45284
45297
  var checkBinaryExpression = createCheckBinaryExpression();
45285
45298
  var emitResolver = createResolver();
45286
45299
  var nodeBuilder = createNodeBuilder();
@@ -64430,7 +64443,10 @@ function createTypeChecker(host) {
64430
64443
  }
64431
64444
  return 0 /* False */;
64432
64445
  }
64433
- if (relation === strictSubtypeRelation && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
64446
+ if ((relation === strictSubtypeRelation || enforceReadonly) && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp) && !(targetProp.flags & 8192 /* Method */)) {
64447
+ if (reportErrors2) {
64448
+ reportError(Diagnostics.Property_0_is_readonly_in_the_source_but_not_in_the_target, symbolToString(targetProp));
64449
+ }
64434
64450
  return 0 /* False */;
64435
64451
  }
64436
64452
  const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState);
@@ -64899,12 +64915,21 @@ function createTypeChecker(host) {
64899
64915
  void 0,
64900
64916
  intersectionState
64901
64917
  );
64902
- if (!related && reportErrors2) {
64903
- if (sourceInfo.keyType === targetInfo.keyType) {
64904
- reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
64905
- } else {
64906
- reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
64918
+ if (!related) {
64919
+ if (reportErrors2) {
64920
+ if (sourceInfo.keyType === targetInfo.keyType) {
64921
+ reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
64922
+ } else {
64923
+ reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
64924
+ }
64925
+ }
64926
+ return 0 /* False */;
64927
+ }
64928
+ if (enforceReadonly && sourceInfo.isReadonly && !targetInfo.isReadonly) {
64929
+ if (reportErrors2) {
64930
+ reportError(Diagnostics._0_index_signature_is_readonly_in_the_source_but_not_in_the_target, typeToString(sourceInfo.keyType));
64907
64931
  }
64932
+ return 0 /* False */;
64908
64933
  }
64909
64934
  return related;
64910
64935
  }
@@ -70417,10 +70442,9 @@ function createTypeChecker(host) {
70417
70442
  (t) => {
70418
70443
  var _a;
70419
70444
  if (isGenericMappedType(t) && !t.declaration.nameType) {
70420
- const constraint = getConstraintTypeFromMappedType(t);
70421
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
70445
+ const constraint = getBaseConstraintOrType(getConstraintTypeFromMappedType(t));
70422
70446
  const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
70423
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
70447
+ if (isTypeAssignableTo(propertyNameType, constraint)) {
70424
70448
  return substituteIndexedMappedType(t, propertyNameType);
70425
70449
  }
70426
70450
  } else if (t.flags & 3670016 /* StructuredType */) {
@@ -70470,23 +70494,17 @@ function createTypeChecker(host) {
70470
70494
  const symbol = getSymbolOfDeclaration(element);
70471
70495
  return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
70472
70496
  }
70473
- if (hasDynamicName(element)) {
70474
- const name = getNameOfDeclaration(element);
70475
- if (name && isComputedPropertyName(name)) {
70476
- const exprType = checkExpression(name.expression);
70477
- const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
70478
- if (propType) {
70479
- return propType;
70480
- }
70497
+ const name = getNameOfDeclaration(element);
70498
+ if (name && isComputedPropertyName(name)) {
70499
+ const exprType = checkExpression(name.expression);
70500
+ if (isTypeUsableAsPropertyName(exprType)) {
70501
+ return getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType), exprType);
70481
70502
  }
70482
- }
70483
- if (element.name) {
70484
- const nameType = getLiteralTypeFromPropertyName(element.name);
70485
70503
  return mapType(
70486
70504
  type,
70487
70505
  (t) => {
70488
70506
  var _a;
70489
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a.type;
70507
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), exprType)) == null ? void 0 : _a.type;
70490
70508
  },
70491
70509
  /*noReductions*/
70492
70510
  true
@@ -70495,6 +70513,20 @@ function createTypeChecker(host) {
70495
70513
  }
70496
70514
  return void 0;
70497
70515
  }
70516
+ function isContextualPropertyMutable(type, name, nameType) {
70517
+ return someType(type, (t) => {
70518
+ const propName = nameType ? isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0 : name;
70519
+ const prop = propName && getPropertyOfType(t, propName);
70520
+ if (prop) {
70521
+ return !isReadonlySymbol(prop);
70522
+ }
70523
+ const indexInfo = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)));
70524
+ if (indexInfo) {
70525
+ return !indexInfo.isReadonly;
70526
+ }
70527
+ return false;
70528
+ });
70529
+ }
70498
70530
  function getSpreadIndices(elements) {
70499
70531
  let first2, last2;
70500
70532
  for (let i = 0; i < elements.length; i++) {
@@ -71286,7 +71318,6 @@ function createTypeChecker(host) {
71286
71318
  );
71287
71319
  const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
71288
71320
  const inConstContext = isConstContext(node);
71289
- const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
71290
71321
  const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
71291
71322
  const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
71292
71323
  const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
@@ -71322,6 +71353,7 @@ function createTypeChecker(host) {
71322
71353
  }
71323
71354
  objectFlags |= getObjectFlags(type) & 458752 /* PropagatingFlags */;
71324
71355
  const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0;
71356
+ const checkFlags = inConstContext && !(enforceReadonly && contextualType && isContextualPropertyMutable(contextualType, member.escapedName, nameType)) ? 8 /* Readonly */ : 0;
71325
71357
  const prop = nameType ? createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
71326
71358
  if (nameType) {
71327
71359
  prop.links.nameType = nameType;
@@ -76993,7 +77025,7 @@ function createTypeChecker(host) {
76993
77025
  parent = parent.parent;
76994
77026
  }
76995
77027
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent)) {
76996
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
77028
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, isIfStatement(parent) ? parent.thenStatement : void 0);
76997
77029
  }
76998
77030
  checkTruthinessOfType(leftType, node.left);
76999
77031
  }
@@ -77551,7 +77583,7 @@ function createTypeChecker(host) {
77551
77583
  }
77552
77584
  function checkConditionalExpression(node, checkMode) {
77553
77585
  const type = checkTruthinessExpression(node.condition, checkMode);
77554
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.condition, type, node.whenTrue);
77586
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
77555
77587
  const type1 = checkExpression(node.whenTrue, checkMode);
77556
77588
  const type2 = checkExpression(node.whenFalse, checkMode);
77557
77589
  return getUnionType([type1, type2], 2 /* Subtype */);
@@ -80599,14 +80631,14 @@ function createTypeChecker(host) {
80599
80631
  function checkIfStatement(node) {
80600
80632
  checkGrammarStatementInAmbientContext(node);
80601
80633
  const type = checkTruthinessExpression(node.expression);
80602
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.expression, type, node.thenStatement);
80634
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
80603
80635
  checkSourceElement(node.thenStatement);
80604
80636
  if (node.thenStatement.kind === 242 /* EmptyStatement */) {
80605
80637
  error(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
80606
80638
  }
80607
80639
  checkSourceElement(node.elseStatement);
80608
80640
  }
80609
- function checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(condExpr, condType, body) {
80641
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
80610
80642
  if (!strictNullChecks)
80611
80643
  return;
80612
80644
  bothHelper(condExpr, body);
@@ -80628,10 +80660,6 @@ function createTypeChecker(host) {
80628
80660
  return;
80629
80661
  }
80630
80662
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
80631
- if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
80632
- error(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
80633
- return;
80634
- }
80635
80663
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
80636
80664
  if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
80637
80665
  return;
@@ -6893,6 +6893,7 @@ declare namespace ts {
6893
6893
  downlevelIteration?: boolean;
6894
6894
  emitBOM?: boolean;
6895
6895
  emitDecoratorMetadata?: boolean;
6896
+ enforceReadonly?: boolean;
6896
6897
  exactOptionalPropertyTypes?: boolean;
6897
6898
  experimentalDecorators?: boolean;
6898
6899
  forceConsistentCasingInFileNames?: boolean;
package/lib/typescript.js CHANGED
@@ -2360,7 +2360,7 @@ module.exports = __toCommonJS(typescript_exports);
2360
2360
 
2361
2361
  // src/compiler/corePublic.ts
2362
2362
  var versionMajorMinor = "5.5";
2363
- var version = `${versionMajorMinor}.0-insiders.20240422`;
2363
+ var version = `${versionMajorMinor}.0-insiders.20240423`;
2364
2364
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2365
2365
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2366
2366
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10492,6 +10492,8 @@ var Diagnostics = {
10492
10492
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
10493
10493
  Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
10494
10494
  One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
10495
+ Property_0_is_readonly_in_the_source_but_not_in_the_target: diag(4127, 1 /* Error */, "Property_0_is_readonly_in_the_source_but_not_in_the_target_4127", "Property '{0}' is 'readonly' in the source but not in the target."),
10496
+ _0_index_signature_is_readonly_in_the_source_but_not_in_the_target: diag(4128, 1 /* Error */, "_0_index_signature_is_readonly_in_the_source_but_not_in_the_target_4128", "'{0}' index signature is 'readonly' in the source but not in the target."),
10495
10497
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
10496
10498
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
10497
10499
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -11061,6 +11063,7 @@ var Diagnostics = {
11061
11063
  Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
11062
11064
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
11063
11065
  Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
11066
+ Ensure_that_readonly_properties_remain_read_only_in_type_relationships: diag(6720, 3 /* Message */, "Ensure_that_readonly_properties_remain_read_only_in_type_relationships_6720", "Ensure that 'readonly' properties remain read-only in type relationships."),
11064
11067
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
11065
11068
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
11066
11069
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
@@ -40681,6 +40684,15 @@ var commandOptionsWithoutBuild = [
40681
40684
  description: Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
40682
40685
  defaultValueDescription: false
40683
40686
  },
40687
+ {
40688
+ name: "enforceReadonly",
40689
+ type: "boolean",
40690
+ affectsSemanticDiagnostics: true,
40691
+ affectsBuildInfo: true,
40692
+ category: Diagnostics.Type_Checking,
40693
+ description: Diagnostics.Ensure_that_readonly_properties_remain_read_only_in_type_relationships,
40694
+ defaultValueDescription: false
40695
+ },
40684
40696
  // Module Resolution
40685
40697
  {
40686
40698
  name: "moduleResolution",
@@ -50105,6 +50117,7 @@ function createTypeChecker(host) {
50105
50117
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
50106
50118
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
50107
50119
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
50120
+ var enforceReadonly = compilerOptions.enforceReadonly;
50108
50121
  var checkBinaryExpression = createCheckBinaryExpression();
50109
50122
  var emitResolver = createResolver();
50110
50123
  var nodeBuilder = createNodeBuilder();
@@ -69254,7 +69267,10 @@ function createTypeChecker(host) {
69254
69267
  }
69255
69268
  return 0 /* False */;
69256
69269
  }
69257
- if (relation === strictSubtypeRelation && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
69270
+ if ((relation === strictSubtypeRelation || enforceReadonly) && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp) && !(targetProp.flags & 8192 /* Method */)) {
69271
+ if (reportErrors2) {
69272
+ reportError(Diagnostics.Property_0_is_readonly_in_the_source_but_not_in_the_target, symbolToString(targetProp));
69273
+ }
69258
69274
  return 0 /* False */;
69259
69275
  }
69260
69276
  const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState);
@@ -69723,12 +69739,21 @@ function createTypeChecker(host) {
69723
69739
  void 0,
69724
69740
  intersectionState
69725
69741
  );
69726
- if (!related && reportErrors2) {
69727
- if (sourceInfo.keyType === targetInfo.keyType) {
69728
- reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
69729
- } else {
69730
- reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
69742
+ if (!related) {
69743
+ if (reportErrors2) {
69744
+ if (sourceInfo.keyType === targetInfo.keyType) {
69745
+ reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
69746
+ } else {
69747
+ reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
69748
+ }
69749
+ }
69750
+ return 0 /* False */;
69751
+ }
69752
+ if (enforceReadonly && sourceInfo.isReadonly && !targetInfo.isReadonly) {
69753
+ if (reportErrors2) {
69754
+ reportError(Diagnostics._0_index_signature_is_readonly_in_the_source_but_not_in_the_target, typeToString(sourceInfo.keyType));
69731
69755
  }
69756
+ return 0 /* False */;
69732
69757
  }
69733
69758
  return related;
69734
69759
  }
@@ -75241,10 +75266,9 @@ function createTypeChecker(host) {
75241
75266
  (t) => {
75242
75267
  var _a;
75243
75268
  if (isGenericMappedType(t) && !t.declaration.nameType) {
75244
- const constraint = getConstraintTypeFromMappedType(t);
75245
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
75269
+ const constraint = getBaseConstraintOrType(getConstraintTypeFromMappedType(t));
75246
75270
  const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
75247
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
75271
+ if (isTypeAssignableTo(propertyNameType, constraint)) {
75248
75272
  return substituteIndexedMappedType(t, propertyNameType);
75249
75273
  }
75250
75274
  } else if (t.flags & 3670016 /* StructuredType */) {
@@ -75294,23 +75318,17 @@ function createTypeChecker(host) {
75294
75318
  const symbol = getSymbolOfDeclaration(element);
75295
75319
  return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
75296
75320
  }
75297
- if (hasDynamicName(element)) {
75298
- const name = getNameOfDeclaration(element);
75299
- if (name && isComputedPropertyName(name)) {
75300
- const exprType = checkExpression(name.expression);
75301
- const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
75302
- if (propType) {
75303
- return propType;
75304
- }
75321
+ const name = getNameOfDeclaration(element);
75322
+ if (name && isComputedPropertyName(name)) {
75323
+ const exprType = checkExpression(name.expression);
75324
+ if (isTypeUsableAsPropertyName(exprType)) {
75325
+ return getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType), exprType);
75305
75326
  }
75306
- }
75307
- if (element.name) {
75308
- const nameType = getLiteralTypeFromPropertyName(element.name);
75309
75327
  return mapType(
75310
75328
  type,
75311
75329
  (t) => {
75312
75330
  var _a;
75313
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a.type;
75331
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), exprType)) == null ? void 0 : _a.type;
75314
75332
  },
75315
75333
  /*noReductions*/
75316
75334
  true
@@ -75319,6 +75337,20 @@ function createTypeChecker(host) {
75319
75337
  }
75320
75338
  return void 0;
75321
75339
  }
75340
+ function isContextualPropertyMutable(type, name, nameType) {
75341
+ return someType(type, (t) => {
75342
+ const propName = nameType ? isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0 : name;
75343
+ const prop = propName && getPropertyOfType(t, propName);
75344
+ if (prop) {
75345
+ return !isReadonlySymbol(prop);
75346
+ }
75347
+ const indexInfo = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)));
75348
+ if (indexInfo) {
75349
+ return !indexInfo.isReadonly;
75350
+ }
75351
+ return false;
75352
+ });
75353
+ }
75322
75354
  function getSpreadIndices(elements) {
75323
75355
  let first2, last2;
75324
75356
  for (let i = 0; i < elements.length; i++) {
@@ -76110,7 +76142,6 @@ function createTypeChecker(host) {
76110
76142
  );
76111
76143
  const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
76112
76144
  const inConstContext = isConstContext(node);
76113
- const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
76114
76145
  const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
76115
76146
  const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
76116
76147
  const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
@@ -76146,6 +76177,7 @@ function createTypeChecker(host) {
76146
76177
  }
76147
76178
  objectFlags |= getObjectFlags(type) & 458752 /* PropagatingFlags */;
76148
76179
  const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0;
76180
+ const checkFlags = inConstContext && !(enforceReadonly && contextualType && isContextualPropertyMutable(contextualType, member.escapedName, nameType)) ? 8 /* Readonly */ : 0;
76149
76181
  const prop = nameType ? createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
76150
76182
  if (nameType) {
76151
76183
  prop.links.nameType = nameType;
@@ -81817,7 +81849,7 @@ function createTypeChecker(host) {
81817
81849
  parent2 = parent2.parent;
81818
81850
  }
81819
81851
  if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) {
81820
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
81852
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0);
81821
81853
  }
81822
81854
  checkTruthinessOfType(leftType, node.left);
81823
81855
  }
@@ -82375,7 +82407,7 @@ function createTypeChecker(host) {
82375
82407
  }
82376
82408
  function checkConditionalExpression(node, checkMode) {
82377
82409
  const type = checkTruthinessExpression(node.condition, checkMode);
82378
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.condition, type, node.whenTrue);
82410
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
82379
82411
  const type1 = checkExpression(node.whenTrue, checkMode);
82380
82412
  const type2 = checkExpression(node.whenFalse, checkMode);
82381
82413
  return getUnionType([type1, type2], 2 /* Subtype */);
@@ -85423,14 +85455,14 @@ function createTypeChecker(host) {
85423
85455
  function checkIfStatement(node) {
85424
85456
  checkGrammarStatementInAmbientContext(node);
85425
85457
  const type = checkTruthinessExpression(node.expression);
85426
- checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(node.expression, type, node.thenStatement);
85458
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
85427
85459
  checkSourceElement(node.thenStatement);
85428
85460
  if (node.thenStatement.kind === 242 /* EmptyStatement */) {
85429
85461
  error2(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
85430
85462
  }
85431
85463
  checkSourceElement(node.elseStatement);
85432
85464
  }
85433
- function checkTestingKnownTruthyCallableOrAwaitableOrEnumMemberType(condExpr, condType, body) {
85465
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
85434
85466
  if (!strictNullChecks)
85435
85467
  return;
85436
85468
  bothHelper(condExpr, body);
@@ -85452,10 +85484,6 @@ function createTypeChecker(host) {
85452
85484
  return;
85453
85485
  }
85454
85486
  const type = location === condExpr2 ? condType : checkTruthinessExpression(location);
85455
- if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) {
85456
- error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false");
85457
- return;
85458
- }
85459
85487
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
85460
85488
  if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
85461
85489
  return;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-pr-58264-13",
5
+ "version": "5.5.0-pr-58296-8",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [