TypeScript export imported interface

后端 未结 3 926
日久生厌
日久生厌 2020-12-07 14:46

I use AMD modules and I want to hide a complex interface behind one file that loads several other files and chooses what to expose and how. It works, I use this solution but

3条回答
  •  自闭症患者
    2020-12-07 15:09

    In my case particularly, I had to 'declare' the interface instead of exporting it.

    declare interface IFluxStoreSyncOptions{
      namespacedKey: string;
    }
    

    In order to use the interface as a type in another file like so:

    export function FluxStoreSync(options: IFluxStoreSyncOptions){
    }
    

    This way you don't have to export and import the interface.

提交回复
热议问题