TS 文档提到了接口和类型别名,但我似乎找不到太多有关导入或导出接口的信息,type并希望得到一些说明:
例如,接口可以导出为:
// located in ./MyInterface.ts
export interface MyInterface
{
foo: string;
bar: () => number;
}
export type {MyInterface as MyInterfaceType}
Run Code Online (Sandbox Code Playgroud)
它可以导入为:
import {MyInterface} from "./MyInterface"
或
import type {MyInterface} from "./MyInterface"
或任何人都可以解释每个接口导入之间
import {MyInterfaceType} from "./MyInterface"
的
import type {MyInterfaceType} from "./MyInterface"
行为差异吗?