Three, eggjs learning record - typescript statement into types inside

If the project needs to be referenced as a module to other projects, and other projects with typescript is written, which requires compatible typescript,

We need to export variables or modules in a statement types directory . Corresponding directory (file name) structure is consistent with the real logic of the code, but the file suffix changed .d.ts  can not be imported directly into an external file, the file does not need to write a statement.

// such as directory structure: 
/ * * 
Project / index.js, 
Project / demo.js 
Project / OTHER / other.js 
* / 
// you can increase the manifest file: 
/ * * 
eggs / types / index.d.ts ,   
eggs / types / demo.d.ts,   
Project / types / other.d.ts 
* / 
// here if the source code does not provide external references do not need to build in a statement document types inside

 

Note that the above structure is only an example of the project has nothing to do with eggs

Guess you like

Origin www.cnblogs.com/hellolol/p/11526417.html