Resolution walks these in order and stops at the first that answers, so a package with no types of
its own still binds. Tier 7 is the floor and cannot fail: whatever the module turns out to be, it
binds as one TSObject and the caller drives it by name.
Tier
Source
What you get
1
the package's own .d.ts
full types
2
@types/<pkg> from DefinitelyTyped
full types
3
JSDoc-annotated .js, demoted on disagreement
most types
4
inference over plain .js
partial types
5
the syntax tree alone
names and arity
6
importing the module and reading it
names and arity
7
the module itself
one TSObject
Tiers 1 through 4 share one code path and differ only in compiler flags. Tier 5 walks the syntax
tree for names the checker did not resolve, and tier 6 imports the module and reads its own
properties, which is the only thing that sees exports a package assembles at run time.
Where a package's types came from.
Resolution walks these in order and stops at the first that answers, so a package with no types of its own still binds. Tier 7 is the floor and cannot fail: whatever the module turns out to be, it binds as one
TSObjectand the caller drives it by name..d.ts@types/<pkg>from DefinitelyTyped.js, demoted on disagreement.jsTSObjectTiers 1 through 4 share one code path and differ only in compiler flags. Tier 5 walks the syntax tree for names the checker did not resolve, and tier 6 imports the module and reads its own properties, which is the only thing that sees exports a package assembles at run time.