// @strict: true
// Repro from #14091
interface Foo {
foo(): void
}
class A
> {
props: Readonly
doSomething() {
this.props.foo && this.props.foo()
}
}
// Repro from #14415
interface Banana {
color: 'yellow';
}
class Monkey {
a: T;
render() {
if (this.a) {
this.a.color;
}
}
}
interface BigBanana extends Banana {
}
class BigMonkey extends Monkey {
render() {
if (this.a) {
this.a.color;
}
}
}
// Another repro
type Item = {
(): string;
x: string;
}
function f1(obj: T) {
if (obj) {
obj.x;
obj["x"];
obj();
}
}
function f2(obj: T | undefined) {
if (obj) {
obj.x;
obj["x"];
obj();
}
}
function f3(obj: T | null) {
if (obj) {
obj.x;
obj["x"];
obj();
}
}
function f4(obj: T | undefined, x: number) {
if (obj) {
obj[x].length;
}
}
function f5(obj: T | undefined, key: K) {
if (obj) {
obj[key];
}
}