How do I import other TypeScript files?

前端 未结 9 1614
北恋
北恋 2020-11-28 20:29

When using the TypeScript plugin for vs.net, how do I make one TypeScript file import modules declared in other TypeScript files?

file 1:

module moo
         


        
9条回答
  •  野性不改
    2020-11-28 20:41

    Since TypeScript 1.8+ you can use simple simple import statement like:

    import { ClassName } from '../relative/path/to/file';
    

    or the wildcard version:

    import * as YourName from 'global-or-relative';
    

    Read more: https://www.typescriptlang.org/docs/handbook/modules.html

提交回复
热议问题