ts中的模块化

1,定义的全是类型(可以加上type ),方便识别

index.ts


interface o1{
    name:string
}
type 02 = {
    age:number
}
export type{o1,o2}



引入

import type{ o1,o2} './index

2,假如既有变量又有别的内容

index.ts


interface o1{
    name:string
}
let abc = 20
export {type o1,abc}



引入

import {type o1,o2} './index