-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add slightly modified example from #25413
- Loading branch information
Showing
5 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/baselines/reference/conditionalTypeSubclassExtendsTypeParam.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//// [conditionalTypeSubclassExtendsTypeParam.ts] | ||
declare class Model<M extends MR, MR extends {}> { | ||
public getField2<K extends keyof M>(): Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]> | ||
} | ||
|
||
declare class Field<T extends TR, TR> { | ||
} | ||
|
||
//// [conditionalTypeSubclassExtendsTypeParam.js] |
28 changes: 28 additions & 0 deletions
28
tests/baselines/reference/conditionalTypeSubclassExtendsTypeParam.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
=== tests/cases/compiler/conditionalTypeSubclassExtendsTypeParam.ts === | ||
declare class Model<M extends MR, MR extends {}> { | ||
>Model : Symbol(Model, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 0)) | ||
>M : Symbol(M, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 20)) | ||
>MR : Symbol(MR, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 33)) | ||
>MR : Symbol(MR, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 33)) | ||
|
||
public getField2<K extends keyof M>(): Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]> | ||
>getField2 : Symbol(Model.getField2, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 50)) | ||
>K : Symbol(K, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 1, 21)) | ||
>M : Symbol(M, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 20)) | ||
>Field : Symbol(Field, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 2, 1)) | ||
>M : Symbol(M, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 20)) | ||
>K : Symbol(K, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 1, 21)) | ||
>K : Symbol(K, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 1, 21)) | ||
>MR : Symbol(MR, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 33)) | ||
>MR : Symbol(MR, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 33)) | ||
>K : Symbol(K, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 1, 21)) | ||
>M : Symbol(M, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 0, 20)) | ||
>K : Symbol(K, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 1, 21)) | ||
} | ||
|
||
declare class Field<T extends TR, TR> { | ||
>Field : Symbol(Field, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 2, 1)) | ||
>T : Symbol(T, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 4, 20)) | ||
>TR : Symbol(TR, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 4, 33)) | ||
>TR : Symbol(TR, Decl(conditionalTypeSubclassExtendsTypeParam.ts, 4, 33)) | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/conditionalTypeSubclassExtendsTypeParam.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/conditionalTypeSubclassExtendsTypeParam.ts === | ||
declare class Model<M extends MR, MR extends {}> { | ||
>Model : Model<M, MR> | ||
|
||
public getField2<K extends keyof M>(): Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]> | ||
>getField2 : <K extends keyof M>() => Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]> | ||
} | ||
|
||
declare class Field<T extends TR, TR> { | ||
>Field : Field<T, TR> | ||
} |
6 changes: 6 additions & 0 deletions
6
tests/cases/compiler/conditionalTypeSubclassExtendsTypeParam.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
declare class Model<M extends MR, MR extends {}> { | ||
public getField2<K extends keyof M>(): Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]> | ||
} | ||
|
||
declare class Field<T extends TR, TR> { | ||
} |