mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
29 lines
624 B
TypeScript
29 lines
624 B
TypeScript
//// [tests/cases/compiler/contextualTypingOfConditionalExpression.ts] ////
|
|
|
|
//// [contextualTypingOfConditionalExpression.ts]
|
|
var x: (a: number) => void = true ? (a) => a.toExponential() : (b) => b.toFixed();
|
|
|
|
class A {
|
|
foo: number;
|
|
}
|
|
class B extends A {
|
|
bar: number;
|
|
}
|
|
class C extends A {
|
|
baz: number;
|
|
}
|
|
|
|
var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo;
|
|
|
|
|
|
//// [contextualTypingOfConditionalExpression.js]
|
|
"use strict";
|
|
var x = true ? (a) => a.toExponential() : (b) => b.toFixed();
|
|
class A {
|
|
}
|
|
class B extends A {
|
|
}
|
|
class C extends A {
|
|
}
|
|
var x2 = true ? (a) => a.foo : (b) => b.foo;
|