How does Typescript load typings? (and what each TS-related file's purpose is)

后端 未结 1 729
故里飘歌
故里飘歌 2021-01-17 05:26

I am becoming familiar with Typescript and typings but it is not yet very clear how to tell Typescript where to find typings (or better... how to tell Types

相关标签:
1条回答
  • 2021-01-17 06:00

    Typescript where to find typings

    Its all about the compilation context. (more). If a file makes it into the context then it is analyzed.

    Ways a file can make it in

    • Its in the files
    • Its in the filesGlob and you are using something that understands filesGlob (e.g. atom-typescript, alm, grunt-ts)
    • Its referenced (i.e. <reference path=) by a file that already made it into the compilation context
    • Its imported (i.e. import foo = require('./foo') etc) but a file that already made it into the compilation context.
    • You passed it in on the command line.
    • It is a lib file (e.g. lib.d.ts)

    Etc.

    Additionally file might be global or a module (more).

    0 讨论(0)
提交回复
热议问题