diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression.js b/tests/baselines/reference/typeArgumentInferenceWithClassExpression.js new file mode 100644 index 00000000000..cc0bf971473 --- /dev/null +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression.js @@ -0,0 +1,22 @@ +//// [typeArgumentInferenceWithClassExpression.ts] +function foo(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; diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression.symbols b/tests/baselines/reference/typeArgumentInferenceWithClassExpression.symbols new file mode 100644 index 00000000000..dac982595cb --- /dev/null +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression.symbols @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts === +function foo(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)) + diff --git a/tests/baselines/reference/typeArgumentInferenceWithClassExpression.types b/tests/baselines/reference/typeArgumentInferenceWithClassExpression.types new file mode 100644 index 00000000000..3eab8a4ab62 --- /dev/null +++ b/tests/baselines/reference/typeArgumentInferenceWithClassExpression.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts === +function foo(x = class { static prop: T }): T { +>foo : (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 : (x?: typeof (Anonymous class)) => T +>class { static prop = "hello" } : typeof (Anonymous class) +>prop : string +>"hello" : string +>length : number + diff --git a/tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts b/tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts new file mode 100644 index 00000000000..21ca07ea2a2 --- /dev/null +++ b/tests/cases/conformance/es6/classExpressions/typeArgumentInferenceWithClassExpression.ts @@ -0,0 +1,5 @@ +function foo(x = class { static prop: T }): T { + return undefined; +} + +foo(class { static prop = "hello" }).length; \ No newline at end of file