diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 96a783a6c9e..50c6d8d85a1 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12438,7 +12438,7 @@ namespace ts { function getAliasSymbolForTypeNode(node: TypeNode) { let host = node.parent; - while (isParenthesizedTypeNode(host)) { + while (isParenthesizedTypeNode(host) || isTypeOperatorNode(host) && host.operator === SyntaxKind.ReadonlyKeyword) { host = host.parent; } return isTypeAlias(host) ? getSymbolOfNode(host) : undefined; diff --git a/tests/baselines/reference/readonlyArraysAndTuples.types b/tests/baselines/reference/readonlyArraysAndTuples.types index a0db326f35e..1f443c702f0 100644 --- a/tests/baselines/reference/readonlyArraysAndTuples.types +++ b/tests/baselines/reference/readonlyArraysAndTuples.types @@ -6,7 +6,7 @@ type T11 = Array; >T11 : T11 type T12 = readonly string[]; ->T12 : readonly string[] +>T12 : T12 type T13 = ReadonlyArray; >T13 : T13 @@ -15,7 +15,7 @@ type T20 = [number, number]; >T20 : T20 type T21 = readonly [number, number]; ->T21 : readonly [number, number] +>T21 : T21 type T30 = readonly string; // Error >T30 : string @@ -24,10 +24,10 @@ type T31 = readonly T; // Error >T31 : T type T32 = readonly readonly string[]; // Error ->T32 : readonly string[] +>T32 : T32 type T33 = readonly Array; // Error ->T33 : string[] +>T33 : T33 function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) { >f1 : (ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) => void diff --git a/tests/baselines/reference/readonlyArraysAndTuples2.types b/tests/baselines/reference/readonlyArraysAndTuples2.types index be75e046528..21872ad63d2 100644 --- a/tests/baselines/reference/readonlyArraysAndTuples2.types +++ b/tests/baselines/reference/readonlyArraysAndTuples2.types @@ -6,7 +6,7 @@ type T11 = Array; >T11 : T11 type T12 = readonly string[]; ->T12 : readonly string[] +>T12 : T12 type T13 = ReadonlyArray; >T13 : T13 @@ -15,7 +15,7 @@ type T20 = [number, number]; >T20 : T20 type T21 = readonly [number, number]; ->T21 : readonly [number, number] +>T21 : T21 declare function f1(ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]): readonly [string, string]; >f1 : (ma: string[], ra: readonly string[], mt: [string, string], rt: readonly [string, string]) => readonly [string, string] diff --git a/tests/baselines/reference/recursiveTypeReferences1.types b/tests/baselines/reference/recursiveTypeReferences1.types index 0c7b0fb101e..f402c9f7ef6 100644 --- a/tests/baselines/reference/recursiveTypeReferences1.types +++ b/tests/baselines/reference/recursiveTypeReferences1.types @@ -347,7 +347,7 @@ type T10 = T10[]; >T10 : T10 type T11 = readonly T11[]; ->T11 : readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly (readonly any[])[])[])[])[])[])[])[])[])[])[] +>T11 : T11 type T12 = (T12)[]; >T12 : T12