Using namespace spread over multiple module files in TypeScript

后端 未结 5 924

I\'ve started work on a large-scale typescript project.

Right from the outset, I want to keep my files organized (this project will be split between lots of developers

5条回答
  •  一整个雨季
    2021-01-31 08:46

    Found a way to achieve your goal but not with the namespace keyword.

    1. The "Animals" classes, Animal.ts & Mammal.ts & Reptile.ts under namespace.
    2. with index.ts for the barrel.
    3. animals.ts for namespace grouping.

    Sample Classes:

    index.ts (as barrel)

    animals.ts (for namespace grouping)

    And here you go of the concept of the namespace.

提交回复
热议问题