mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Test that type parameters used in constraints are passed along
This commit is contained in:
parent
fe015ef30f
commit
0c8d85fbc4
@ -574,6 +574,13 @@ namespace A {
|
||||
[#|t1.toString();
|
||||
t2.toString();|]
|
||||
}
|
||||
}`);
|
||||
// Confirm that the constraint is preserved.
|
||||
testExtractMethod("extractMethod15",
|
||||
`function F<T>(t1: T) {
|
||||
function F<U extends T[]>(t2: U) {
|
||||
[#|t2.toString();|]
|
||||
}
|
||||
}`);
|
||||
});
|
||||
|
||||
@ -590,7 +597,7 @@ namespace A {
|
||||
path: "/a.ts",
|
||||
content: t.source
|
||||
};
|
||||
const host = projectSystem.createServerHost([f]);
|
||||
const host = projectSystem.createServerHost([f, projectSystem.libFile]);
|
||||
const projectService = projectSystem.createProjectService(host);
|
||||
projectService.openClientFile(f.path);
|
||||
const program = projectService.inferredProjects[0].getLanguageService().getProgram();
|
||||
|
||||
35
tests/baselines/reference/extractMethod/extractMethod15.ts
Normal file
35
tests/baselines/reference/extractMethod/extractMethod15.ts
Normal file
@ -0,0 +1,35 @@
|
||||
// ==ORIGINAL==
|
||||
function F<T>(t1: T) {
|
||||
function F<U extends T[]>(t2: U) {
|
||||
t2.toString();
|
||||
}
|
||||
}
|
||||
// ==SCOPE::function 'F'==
|
||||
function F<T>(t1: T) {
|
||||
function F<U extends T[]>(t2: U) {
|
||||
newFunction();
|
||||
|
||||
function newFunction() {
|
||||
t2.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
// ==SCOPE::function 'F'==
|
||||
function F<T>(t1: T) {
|
||||
function F<U extends T[]>(t2: U) {
|
||||
newFunction<U>(t2);
|
||||
}
|
||||
|
||||
function newFunction<U extends T[]>(t2: U) {
|
||||
t2.toString();
|
||||
}
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
function F<T>(t1: T) {
|
||||
function F<U extends T[]>(t2: U) {
|
||||
newFunction<T, U>(t2);
|
||||
}
|
||||
}
|
||||
function newFunction<T, U extends T[]>(t2: U) {
|
||||
t2.toString();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user