Add a test
This commit is contained in:
parent
f37fc1d42e
commit
f56298a0cd
|
@ -0,0 +1,22 @@
|
|||
//// [typeArgumentInferenceWithClassExpression.ts]
|
||||
function foo<T>(x = class { static prop: T }): T {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
foo(class { static prop = "hello" }).length;
|
||||
|
||||
//// [typeArgumentInferenceWithClassExpression.js]
|
||||
function foo(x) {
|
||||
if (x === void 0) { x = (function () {
|
||||
function class_1() {
|
||||
}
|
||||
return class_1;
|
||||
})(); }
|
||||
return undefined;
|
||||
}
|
||||
foo((function () {
|
||||
function class_2() {
|
||||
}
|
||||
class_2.prop = "hello";
|
||||
return class_2;
|
||||
})()).length;
|
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts ===
|
||||
function foo<T>(x = class { static prop: T }): T {
|
||||
>foo : Symbol(foo, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 13))
|
||||
>x : Symbol(x, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 16))
|
||||
>prop : Symbol((Anonymous class).prop, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 27))
|
||||
>T : Symbol(T, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 13))
|
||||
>T : Symbol(T, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 13))
|
||||
|
||||
return undefined;
|
||||
>undefined : Symbol(undefined)
|
||||
}
|
||||
|
||||
foo(class { static prop = "hello" }).length;
|
||||
>foo(class { static prop = "hello" }).length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
||||
>foo : Symbol(foo, Decl(typeArgumentInferenceWithClassExpression.ts, 0, 0))
|
||||
>prop : Symbol((Anonymous class).prop, Decl(typeArgumentInferenceWithClassExpression.ts, 4, 11))
|
||||
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
=== tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts ===
|
||||
function foo<T>(x = class { static prop: T }): T {
|
||||
>foo : <T>(x?: typeof (Anonymous class)) => T
|
||||
>T : T
|
||||
>x : typeof (Anonymous class)
|
||||
>class { static prop: T } : typeof (Anonymous class)
|
||||
>prop : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return undefined;
|
||||
>undefined : undefined
|
||||
}
|
||||
|
||||
foo(class { static prop = "hello" }).length;
|
||||
>foo(class { static prop = "hello" }).length : number
|
||||
>foo(class { static prop = "hello" }) : string
|
||||
>foo : <T>(x?: typeof (Anonymous class)) => T
|
||||
>class { static prop = "hello" } : typeof (Anonymous class)
|
||||
>prop : string
|
||||
>"hello" : string
|
||||
>length : number
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
function foo<T>(x = class { static prop: T }): T {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
foo(class { static prop = "hello" }).length;
|
Loading…
Reference in a new issue