Why the limitation on exporting an interface by default in TypeScript?

后端 未结 2 779
离开以前
离开以前 2021-02-06 20:33

I\'m using TypeScript 1.5 beta, and I\'m trying to export an interface as the default export. The following code causes an error in both Visual Studio and WebStorm:



        
2条回答
  •  没有蜡笔的小新
    2021-02-06 21:01

    it is not necessary to export the interface

    // Foo.ts
    interface Foo {}
    
    // Bar.ts
    class Bar {
        constructor(foo:Foo) {}
    }
    

提交回复
热议问题