mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accept new baselines
This commit is contained in:
+4
-3
@@ -814,7 +814,7 @@ declare namespace ts {
|
||||
}
|
||||
interface TypeOperatorNode extends TypeNode {
|
||||
kind: SyntaxKind.TypeOperator;
|
||||
operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword;
|
||||
operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword;
|
||||
type: TypeNode;
|
||||
}
|
||||
interface IndexedAccessTypeNode extends TypeNode {
|
||||
@@ -2282,6 +2282,7 @@ declare namespace ts {
|
||||
interface TupleType extends GenericType {
|
||||
minLength: number;
|
||||
hasRestElement: boolean;
|
||||
readonly: boolean;
|
||||
associatedNames?: __String[];
|
||||
}
|
||||
interface TupleTypeReference extends TypeReference {
|
||||
@@ -3754,7 +3755,7 @@ declare namespace ts {
|
||||
function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode;
|
||||
function createThisTypeNode(): ThisTypeNode;
|
||||
function createTypeOperatorNode(type: TypeNode): TypeOperatorNode;
|
||||
function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword, type: TypeNode): TypeOperatorNode;
|
||||
function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode;
|
||||
function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode;
|
||||
function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
|
||||
function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
|
||||
@@ -8326,7 +8327,7 @@ declare namespace ts.server {
|
||||
excludedFiles: ReadonlyArray<NormalizedPath>;
|
||||
private typeAcquisition;
|
||||
updateGraph(): boolean;
|
||||
getExcludedFiles(): ReadonlyArray<NormalizedPath>;
|
||||
getExcludedFiles(): readonly NormalizedPath[];
|
||||
getTypeAcquisition(): TypeAcquisition;
|
||||
setTypeAcquisition(newTypeAcquisition: TypeAcquisition): void;
|
||||
}
|
||||
|
||||
+3
-2
@@ -814,7 +814,7 @@ declare namespace ts {
|
||||
}
|
||||
interface TypeOperatorNode extends TypeNode {
|
||||
kind: SyntaxKind.TypeOperator;
|
||||
operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword;
|
||||
operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword;
|
||||
type: TypeNode;
|
||||
}
|
||||
interface IndexedAccessTypeNode extends TypeNode {
|
||||
@@ -2282,6 +2282,7 @@ declare namespace ts {
|
||||
interface TupleType extends GenericType {
|
||||
minLength: number;
|
||||
hasRestElement: boolean;
|
||||
readonly: boolean;
|
||||
associatedNames?: __String[];
|
||||
}
|
||||
interface TupleTypeReference extends TypeReference {
|
||||
@@ -3754,7 +3755,7 @@ declare namespace ts {
|
||||
function updateParenthesizedType(node: ParenthesizedTypeNode, type: TypeNode): ParenthesizedTypeNode;
|
||||
function createThisTypeNode(): ThisTypeNode;
|
||||
function createTypeOperatorNode(type: TypeNode): TypeOperatorNode;
|
||||
function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword, type: TypeNode): TypeOperatorNode;
|
||||
function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode;
|
||||
function updateTypeOperatorNode(node: TypeOperatorNode, type: TypeNode): TypeOperatorNode;
|
||||
function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
|
||||
function updateIndexedAccessTypeNode(node: IndexedAccessTypeNode, objectType: TypeNode, indexType: TypeNode): IndexedAccessTypeNode;
|
||||
|
||||
@@ -30,15 +30,15 @@ const foundNumber: number | undefined = arrayOfStringsNumbersAndBooleans.find(is
|
||||
>isNumber : (x: any) => x is number
|
||||
|
||||
const readonlyArrayOfStringsNumbersAndBooleans = arrayOfStringsNumbersAndBooleans as ReadonlyArray<string | number | boolean>;
|
||||
>readonlyArrayOfStringsNumbersAndBooleans : ReadonlyArray<string | number | boolean>
|
||||
>arrayOfStringsNumbersAndBooleans as ReadonlyArray<string | number | boolean> : ReadonlyArray<string | number | boolean>
|
||||
>readonlyArrayOfStringsNumbersAndBooleans : readonly (string | number | boolean)[]
|
||||
>arrayOfStringsNumbersAndBooleans as ReadonlyArray<string | number | boolean> : readonly (string | number | boolean)[]
|
||||
>arrayOfStringsNumbersAndBooleans : (string | number | boolean)[]
|
||||
|
||||
const readonlyFoundNumber: number | undefined = readonlyArrayOfStringsNumbersAndBooleans.find(isNumber);
|
||||
>readonlyFoundNumber : number
|
||||
>readonlyArrayOfStringsNumbersAndBooleans.find(isNumber) : number
|
||||
>readonlyArrayOfStringsNumbersAndBooleans.find : { <S extends string | number | boolean>(predicate: (this: void, value: string | number | boolean, index: number, obj: ReadonlyArray<string | number | boolean>) => value is S, thisArg?: any): S; (predicate: (value: string | number | boolean, index: number, obj: ReadonlyArray<string | number | boolean>) => boolean, thisArg?: any): string | number | boolean; }
|
||||
>readonlyArrayOfStringsNumbersAndBooleans : ReadonlyArray<string | number | boolean>
|
||||
>find : { <S extends string | number | boolean>(predicate: (this: void, value: string | number | boolean, index: number, obj: ReadonlyArray<string | number | boolean>) => value is S, thisArg?: any): S; (predicate: (value: string | number | boolean, index: number, obj: ReadonlyArray<string | number | boolean>) => boolean, thisArg?: any): string | number | boolean; }
|
||||
>readonlyArrayOfStringsNumbersAndBooleans.find : { <S extends string | number | boolean>(predicate: (this: void, value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => value is S, thisArg?: any): S; (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => boolean, thisArg?: any): string | number | boolean; }
|
||||
>readonlyArrayOfStringsNumbersAndBooleans : readonly (string | number | boolean)[]
|
||||
>find : { <S extends string | number | boolean>(predicate: (this: void, value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => value is S, thisArg?: any): S; (predicate: (value: string | number | boolean, index: number, obj: readonly (string | number | boolean)[]) => boolean, thisArg?: any): string | number | boolean; }
|
||||
>isNumber : (x: any) => x is number
|
||||
|
||||
|
||||
@@ -4,22 +4,22 @@ const array: number[] = [];
|
||||
>[] : undefined[]
|
||||
|
||||
const readonlyArray: ReadonlyArray<number> = [];
|
||||
>readonlyArray : ReadonlyArray<number>
|
||||
>readonlyArray : readonly number[]
|
||||
>[] : undefined[]
|
||||
|
||||
array.flatMap((): ReadonlyArray<number> => []); // ok
|
||||
>array.flatMap((): ReadonlyArray<number> => []) : number[]
|
||||
>array.flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | ReadonlyArray<U>, thisArg?: This) => U[]
|
||||
>array.flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]
|
||||
>array : number[]
|
||||
>flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | ReadonlyArray<U>, thisArg?: This) => U[]
|
||||
>(): ReadonlyArray<number> => [] : () => ReadonlyArray<number>
|
||||
>flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]
|
||||
>(): ReadonlyArray<number> => [] : () => readonly number[]
|
||||
>[] : undefined[]
|
||||
|
||||
readonlyArray.flatMap((): ReadonlyArray<number> => []); // ok
|
||||
>readonlyArray.flatMap((): ReadonlyArray<number> => []) : number[]
|
||||
>readonlyArray.flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | ReadonlyArray<U>, thisArg?: This) => U[]
|
||||
>readonlyArray : ReadonlyArray<number>
|
||||
>flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | ReadonlyArray<U>, thisArg?: This) => U[]
|
||||
>(): ReadonlyArray<number> => [] : () => ReadonlyArray<number>
|
||||
>readonlyArray.flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]
|
||||
>readonlyArray : readonly number[]
|
||||
>flatMap : <U, This = undefined>(callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]
|
||||
>(): ReadonlyArray<number> => [] : () => readonly number[]
|
||||
>[] : undefined[]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray<B>'.
|
||||
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'readonly B[]'.
|
||||
Property 'b' is missing in type 'A' but required in type 'B'.
|
||||
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C<A>' is not assignable to type 'ReadonlyArray<B>'.
|
||||
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
|
||||
Types of property 'concat' are incompatible.
|
||||
Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
|
||||
Type 'A[]' is not assignable to type 'B[]'.
|
||||
@@ -22,7 +22,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
|
||||
rra = arb;
|
||||
rrb = ara; // error: 'A' is not assignable to 'B'
|
||||
~~~
|
||||
!!! error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray<B>'.
|
||||
!!! error TS2322: Type 'A[]' is not assignable to type 'readonly B[]'.
|
||||
!!! error TS2322: Property 'b' is missing in type 'A' but required in type 'B'.
|
||||
!!! related TS2728 tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts:2:21: 'b' is declared here.
|
||||
|
||||
@@ -31,7 +31,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
|
||||
rrb = crb;
|
||||
rrb = cra; // error: 'A' is not assignable to 'B'
|
||||
~~~
|
||||
!!! error TS2322: Type 'C<A>' is not assignable to type 'ReadonlyArray<B>'.
|
||||
!!! error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
|
||||
!!! error TS2322: Types of property 'concat' are incompatible.
|
||||
!!! error TS2322: Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
|
||||
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
|
||||
|
||||
@@ -26,48 +26,48 @@ declare var crb: C<B>;
|
||||
>crb : C<B>
|
||||
|
||||
declare var rra: ReadonlyArray<A>;
|
||||
>rra : ReadonlyArray<A>
|
||||
>rra : readonly A[]
|
||||
|
||||
declare var rrb: ReadonlyArray<B>;
|
||||
>rrb : ReadonlyArray<B>
|
||||
>rrb : readonly B[]
|
||||
|
||||
rra = ara;
|
||||
>rra = ara : A[]
|
||||
>rra : ReadonlyArray<A>
|
||||
>rra : readonly A[]
|
||||
>ara : A[]
|
||||
|
||||
rrb = arb; // OK, Array<B> is assignable to ReadonlyArray<A>
|
||||
>rrb = arb : B[]
|
||||
>rrb : ReadonlyArray<B>
|
||||
>rrb : readonly B[]
|
||||
>arb : B[]
|
||||
|
||||
rra = arb;
|
||||
>rra = arb : B[]
|
||||
>rra : ReadonlyArray<A>
|
||||
>rra : readonly A[]
|
||||
>arb : B[]
|
||||
|
||||
rrb = ara; // error: 'A' is not assignable to 'B'
|
||||
>rrb = ara : A[]
|
||||
>rrb : ReadonlyArray<B>
|
||||
>rrb : readonly B[]
|
||||
>ara : A[]
|
||||
|
||||
rra = cra;
|
||||
>rra = cra : C<A>
|
||||
>rra : ReadonlyArray<A>
|
||||
>rra : readonly A[]
|
||||
>cra : C<A>
|
||||
|
||||
rra = crb; // OK, C<B> is assignable to ReadonlyArray<A>
|
||||
>rra = crb : C<B>
|
||||
>rra : ReadonlyArray<A>
|
||||
>rra : readonly A[]
|
||||
>crb : C<B>
|
||||
|
||||
rrb = crb;
|
||||
>rrb = crb : C<B>
|
||||
>rrb : ReadonlyArray<B>
|
||||
>rrb : readonly B[]
|
||||
>crb : C<B>
|
||||
|
||||
rrb = cra; // error: 'A' is not assignable to 'B'
|
||||
>rrb = cra : C<A>
|
||||
>rrb : ReadonlyArray<B>
|
||||
>rrb : readonly B[]
|
||||
>cra : C<A>
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
interface Array<T> {
|
||||
equalsShallow<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>): boolean;
|
||||
>equalsShallow : <T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean
|
||||
>this : ReadonlyArray<T>
|
||||
>other : ReadonlyArray<T>
|
||||
>equalsShallow : <T>(this: readonly T[], other: readonly T[]) => boolean
|
||||
>this : readonly T[]
|
||||
>other : readonly T[]
|
||||
}
|
||||
|
||||
declare const a: (string | number)[] | null[] | undefined[] | {}[];
|
||||
@@ -19,8 +19,8 @@ declare const b: (string | number)[] | null[] | undefined[] | {}[];
|
||||
let x = a.equalsShallow(b);
|
||||
>x : boolean
|
||||
>a.equalsShallow(b) : boolean
|
||||
>a.equalsShallow : (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean) | (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean) | (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean) | (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean)
|
||||
>a.equalsShallow : (<T>(this: readonly T[], other: readonly T[]) => boolean) | (<T>(this: readonly T[], other: readonly T[]) => boolean) | (<T>(this: readonly T[], other: readonly T[]) => boolean) | (<T>(this: readonly T[], other: readonly T[]) => boolean)
|
||||
>a : (string | number)[] | null[] | undefined[] | {}[]
|
||||
>equalsShallow : (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean) | (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean) | (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean) | (<T>(this: ReadonlyArray<T>, other: ReadonlyArray<T>) => boolean)
|
||||
>equalsShallow : (<T>(this: readonly T[], other: readonly T[]) => boolean) | (<T>(this: readonly T[], other: readonly T[]) => boolean) | (<T>(this: readonly T[], other: readonly T[]) => boolean) | (<T>(this: readonly T[], other: readonly T[]) => boolean)
|
||||
>b : (string | number)[] | null[] | undefined[] | {}[]
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
Object.freeze({
|
||||
>Object.freeze({ foo() { return Object.freeze('a'); },}) : Readonly<{ foo(): string; }>
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>{ foo() { return Object.freeze('a'); },} : { foo(): string; }
|
||||
|
||||
foo() {
|
||||
@@ -13,9 +13,9 @@ Object.freeze({
|
||||
|
||||
return Object.freeze('a');
|
||||
>Object.freeze('a') : string
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>'a' : "a"
|
||||
|
||||
},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
=== tests/cases/compiler/doNotInferUnrelatedTypes.ts ===
|
||||
// #16709
|
||||
declare function dearray<T>(ara: ReadonlyArray<T>): T;
|
||||
>dearray : <T>(ara: ReadonlyArray<T>) => T
|
||||
>ara : ReadonlyArray<T>
|
||||
>dearray : <T>(ara: readonly T[]) => T
|
||||
>ara : readonly T[]
|
||||
|
||||
type LiteralType = "foo" | "bar";
|
||||
>LiteralType : LiteralType
|
||||
@@ -13,6 +13,6 @@ declare var alt: Array<LiteralType>;
|
||||
let foo: LiteralType = dearray(alt);
|
||||
>foo : LiteralType
|
||||
>dearray(alt) : LiteralType
|
||||
>dearray : <T>(ara: ReadonlyArray<T>) => T
|
||||
>dearray : <T>(ara: readonly T[]) => T
|
||||
>alt : LiteralType[]
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ declare function from<T>(): T[];
|
||||
>from : <T>() => T[]
|
||||
|
||||
const c2: ReadonlyArray<A> = from();
|
||||
>c2 : ReadonlyArray<Nominal<"A", string>>
|
||||
>c2 : readonly Nominal<"A", string>[]
|
||||
>from() : Nominal<"A", string>[]
|
||||
>from : <T>() => T[]
|
||||
|
||||
|
||||
@@ -1873,9 +1873,9 @@ class SampleClass<P> {
|
||||
>this : this
|
||||
>props : Readonly<P>
|
||||
>Object.freeze(props) : Readonly<P>
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>props : P
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ type T12 = Required<string[]>;
|
||||
>T12 : string[]
|
||||
|
||||
type T13 = Boxified<ReadonlyArray<string>>;
|
||||
>T13 : ReadonlyArray<Box<string>>
|
||||
>T13 : readonly Box<string>[]
|
||||
|
||||
type T14 = Partial<ReadonlyArray<string>>;
|
||||
>T14 : ReadonlyArray<string | undefined>
|
||||
>T14 : readonly (string | undefined)[]
|
||||
|
||||
type T15 = Required<ReadonlyArray<string>>;
|
||||
>T15 : ReadonlyArray<string>
|
||||
>T15 : readonly string[]
|
||||
|
||||
type T20 = Boxified<(string | undefined)[]>;
|
||||
>T20 : Box<string | undefined>[]
|
||||
@@ -43,13 +43,13 @@ type T22 = Required<(string | undefined)[]>;
|
||||
>T22 : string[]
|
||||
|
||||
type T23 = Boxified<ReadonlyArray<string | undefined>>;
|
||||
>T23 : ReadonlyArray<Box<string | undefined>>
|
||||
>T23 : readonly Box<string | undefined>[]
|
||||
|
||||
type T24 = Partial<ReadonlyArray<string | undefined>>;
|
||||
>T24 : ReadonlyArray<string | undefined>
|
||||
>T24 : readonly (string | undefined)[]
|
||||
|
||||
type T25 = Required<ReadonlyArray<string | undefined>>;
|
||||
>T25 : ReadonlyArray<string>
|
||||
>T25 : readonly string[]
|
||||
|
||||
type T30 = Boxified<Partial<string[]>>;
|
||||
>T30 : Box<string | undefined>[]
|
||||
@@ -66,7 +66,7 @@ type B = { b: string };
|
||||
>b : string
|
||||
|
||||
type T40 = Boxified<A | A[] | ReadonlyArray<A> | [A, B] | string | string[]>;
|
||||
>T40 : string | Box<string>[] | Boxified<A> | Box<A>[] | ReadonlyArray<Box<A>> | [Box<A>, Box<B>]
|
||||
>T40 : string | Box<string>[] | Boxified<A> | Box<A>[] | readonly Box<A>[] | [Box<A>, Box<B>]
|
||||
|
||||
declare function unboxify<T>(x: Boxified<T>): T;
|
||||
>unboxify : <T>(x: Boxified<T>) => T
|
||||
|
||||
@@ -117,6 +117,6 @@ function f(x = 0, b = false) {
|
||||
>1 : 1
|
||||
}
|
||||
function f2(_: ReadonlyArray<number>): void {}
|
||||
>f2 : (_: ReadonlyArray<number>) => void
|
||||
>_ : ReadonlyArray<number>
|
||||
>f2 : (_: readonly number[]) => void
|
||||
>_ : readonly number[]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/compiler/objectFreeze.ts(9,1): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/compiler/objectFreeze.ts(9,1): error TS2542: Index signature in type 'ReadonlyArray<number>' only permits reading.
|
||||
tests/cases/compiler/objectFreeze.ts(9,1): error TS2542: Index signature in type 'readonly number[]' only permits reading.
|
||||
tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' because it is a read-only property.
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ tests/cases/compiler/objectFreeze.ts(12,3): error TS2540: Cannot assign to 'b' b
|
||||
~~~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
~~~~
|
||||
!!! error TS2542: Index signature in type 'ReadonlyArray<number>' only permits reading.
|
||||
!!! error TS2542: Index signature in type 'readonly number[]' only permits reading.
|
||||
|
||||
const o = Object.freeze({ a: 1, b: "string" });
|
||||
o.b = o.a.toString();
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
const f = Object.freeze(function foo(a: number, b: string) { return false; });
|
||||
>f : (a: number, b: string) => false
|
||||
>Object.freeze(function foo(a: number, b: string) { return false; }) : (a: number, b: string) => false
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>function foo(a: number, b: string) { return false; } : (a: number, b: string) => false
|
||||
>foo : (a: number, b: string) => false
|
||||
>a : number
|
||||
@@ -26,9 +26,9 @@ class C { constructor(a: number) { } }
|
||||
const c = Object.freeze(C);
|
||||
>c : typeof C
|
||||
>Object.freeze(C) : typeof C
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>C : typeof C
|
||||
|
||||
new c(1);
|
||||
@@ -37,11 +37,11 @@ new c(1);
|
||||
>1 : 1
|
||||
|
||||
const a = Object.freeze([1, 2, 3]);
|
||||
>a : ReadonlyArray<number>
|
||||
>Object.freeze([1, 2, 3]) : ReadonlyArray<number>
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>a : readonly number[]
|
||||
>Object.freeze([1, 2, 3]) : readonly number[]
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : 1
|
||||
>2 : 2
|
||||
@@ -50,21 +50,21 @@ const a = Object.freeze([1, 2, 3]);
|
||||
a[0] = a[2].toString();
|
||||
>a[0] = a[2].toString() : string
|
||||
>a[0] : number
|
||||
>a : ReadonlyArray<number>
|
||||
>a : readonly number[]
|
||||
>0 : 0
|
||||
>a[2].toString() : string
|
||||
>a[2].toString : (radix?: number) => string
|
||||
>a[2] : number
|
||||
>a : ReadonlyArray<number>
|
||||
>a : readonly number[]
|
||||
>2 : 2
|
||||
>toString : (radix?: number) => string
|
||||
|
||||
const o = Object.freeze({ a: 1, b: "string" });
|
||||
>o : Readonly<{ a: number; b: string; }>
|
||||
>Object.freeze({ a: 1, b: "string" }) : Readonly<{ a: number; b: string; }>
|
||||
>Object.freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object.freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>Object : ObjectConstructor
|
||||
>freeze : { <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>freeze : { <T>(a: T[]): readonly T[]; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; }
|
||||
>{ a: 1, b: "string" } : { a: number; b: string; }
|
||||
>a : number
|
||||
>1 : 1
|
||||
|
||||
@@ -97,13 +97,13 @@ const x11 = f3(never, fo, fx); // "def"
|
||||
// Repro from #21112
|
||||
|
||||
declare function foo<T>(a: ReadonlyArray<T>): T;
|
||||
>foo : <T>(a: ReadonlyArray<T>) => T
|
||||
>a : ReadonlyArray<T>
|
||||
>foo : <T>(a: readonly T[]) => T
|
||||
>a : readonly T[]
|
||||
|
||||
let x = foo([]); // never
|
||||
>x : never
|
||||
>foo([]) : never
|
||||
>foo : <T>(a: ReadonlyArray<T>) => T
|
||||
>foo : <T>(a: readonly T[]) => T
|
||||
>[] : never[]
|
||||
|
||||
// Modified repros from #26127
|
||||
|
||||
Reference in New Issue
Block a user