Update tests
This commit is contained in:
parent
4123068f19
commit
a6dfd66fc1
4 changed files with 56 additions and 0 deletions
|
@ -74,6 +74,12 @@ function f4<T extends string[] | undefined>(obj: T | undefined, x: number) {
|
|||
obj[x].length;
|
||||
}
|
||||
}
|
||||
|
||||
function f5<T, K extends keyof T>(obj: T | undefined, key: K) {
|
||||
if (obj) {
|
||||
obj[key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [typeVariableTypeGuards.js]
|
||||
|
@ -145,3 +151,8 @@ function f4(obj, x) {
|
|||
obj[x].length;
|
||||
}
|
||||
}
|
||||
function f5(obj, key) {
|
||||
if (obj) {
|
||||
obj[key];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,3 +200,22 @@ function f4<T extends string[] | undefined>(obj: T | undefined, x: number) {
|
|||
}
|
||||
}
|
||||
|
||||
function f5<T, K extends keyof T>(obj: T | undefined, key: K) {
|
||||
>f5 : Symbol(f5, Decl(typeVariableTypeGuards.ts, 74, 1))
|
||||
>T : Symbol(T, Decl(typeVariableTypeGuards.ts, 76, 12))
|
||||
>K : Symbol(K, Decl(typeVariableTypeGuards.ts, 76, 14))
|
||||
>T : Symbol(T, Decl(typeVariableTypeGuards.ts, 76, 12))
|
||||
>obj : Symbol(obj, Decl(typeVariableTypeGuards.ts, 76, 34))
|
||||
>T : Symbol(T, Decl(typeVariableTypeGuards.ts, 76, 12))
|
||||
>key : Symbol(key, Decl(typeVariableTypeGuards.ts, 76, 53))
|
||||
>K : Symbol(K, Decl(typeVariableTypeGuards.ts, 76, 14))
|
||||
|
||||
if (obj) {
|
||||
>obj : Symbol(obj, Decl(typeVariableTypeGuards.ts, 76, 34))
|
||||
|
||||
obj[key];
|
||||
>obj : Symbol(obj, Decl(typeVariableTypeGuards.ts, 76, 34))
|
||||
>key : Symbol(key, Decl(typeVariableTypeGuards.ts, 76, 53))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,3 +210,23 @@ function f4<T extends string[] | undefined>(obj: T | undefined, x: number) {
|
|||
}
|
||||
}
|
||||
|
||||
function f5<T, K extends keyof T>(obj: T | undefined, key: K) {
|
||||
>f5 : <T, K extends keyof T>(obj: T | undefined, key: K) => void
|
||||
>T : T
|
||||
>K : K
|
||||
>T : T
|
||||
>obj : T | undefined
|
||||
>T : T
|
||||
>key : K
|
||||
>K : K
|
||||
|
||||
if (obj) {
|
||||
>obj : T | undefined
|
||||
|
||||
obj[key];
|
||||
>obj[key] : T[K]
|
||||
>obj : T
|
||||
>key : K
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,3 +75,9 @@ function f4<T extends string[] | undefined>(obj: T | undefined, x: number) {
|
|||
obj[x].length;
|
||||
}
|
||||
}
|
||||
|
||||
function f5<T, K extends keyof T>(obj: T | undefined, key: K) {
|
||||
if (obj) {
|
||||
obj[key];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue