78 lines
1.5 KiB
Text
78 lines
1.5 KiB
Text
|
=== tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne.ts ===
|
||
|
// inner type parameters shadow outer ones of the same name
|
||
|
// no errors expected
|
||
|
|
||
|
function f<T extends Date>() {
|
||
|
>f : <T extends Date>() => void
|
||
|
>T : T
|
||
|
>Date : Date
|
||
|
|
||
|
function g<T extends Number>() {
|
||
|
>g : <T extends Number>() => void
|
||
|
>T : T
|
||
|
>Number : Number
|
||
|
|
||
|
var x: T;
|
||
|
>x : T
|
||
|
>T : T
|
||
|
|
||
|
x.toFixed();
|
||
|
>x.toFixed() : string
|
||
|
>x.toFixed : (fractionDigits?: number) => string
|
||
|
>x : T
|
||
|
>toFixed : (fractionDigits?: number) => string
|
||
|
}
|
||
|
var x: T;
|
||
|
>x : T
|
||
|
>T : T
|
||
|
|
||
|
x.getDate();
|
||
|
>x.getDate() : number
|
||
|
>x.getDate : () => number
|
||
|
>x : T
|
||
|
>getDate : () => number
|
||
|
}
|
||
|
|
||
|
function f2<T extends Date, U extends Date>() {
|
||
|
>f2 : <T extends Date, U extends Date>() => void
|
||
|
>T : T
|
||
|
>Date : Date
|
||
|
>U : U
|
||
|
>Date : Date
|
||
|
|
||
|
function g<T extends Number, U extends Number>() {
|
||
|
>g : <T extends Number, U extends Number>() => void
|
||
|
>T : T
|
||
|
>Number : Number
|
||
|
>U : U
|
||
|
>Number : Number
|
||
|
|
||
|
var x: U;
|
||
|
>x : U
|
||
|
>U : U
|
||
|
|
||
|
x.toFixed();
|
||
|
>x.toFixed() : string
|
||
|
>x.toFixed : (fractionDigits?: number) => string
|
||
|
>x : U
|
||
|
>toFixed : (fractionDigits?: number) => string
|
||
|
}
|
||
|
var x: U;
|
||
|
>x : U
|
||
|
>U : U
|
||
|
|
||
|
x.getDate();
|
||
|
>x.getDate() : number
|
||
|
>x.getDate : () => number
|
||
|
>x : U
|
||
|
>getDate : () => number
|
||
|
}
|
||
|
//function f2<T extends Date, U extends T>() {
|
||
|
// function g<T extends Number, U extends T>() {
|
||
|
// var x: U;
|
||
|
// x.toFixed();
|
||
|
// }
|
||
|
// var x: U;
|
||
|
// x.getDate();
|
||
|
//}
|