I hear that type
and interface
only have different when you want using things like &
or extends
, but......
Why
interface ITest {
a: boolean;
}
const Itest: ITest = { a: true };
const test: { [index: string]: boolean } = Itest;
cant pass compile, while
type TTest = {
a: boolean,
};
const Ttest: TTest = { a: true };
const test: { [index: string]: boolean } = Ttest;
have not?