The following will compile
interface Foo {
success: boolean
}
interface Bar {
success: boolean
}
const foo = (v: Foo) =>{
};
const bar = (v: Bar) =>{
};
bar(<Foo>{success: true});
bar(<Bar>{success: true});
it will compile because of the way that TS works, which is usually very convenient. But in some cases we may want to restrict to the exact type.
Basically, I am looking to prevent compilation for:
bar(<Foo>{success: true});
I want it to be restricted to:
bar(<Bar>{success: true});
is that possible?
The following will compile
it will compile because of the way that TS works, which is usually very convenient. But in some cases we may want to restrict to the exact type.
Basically, I am looking to prevent compilation for:
I want it to be restricted to:
is that possible?