Skip to content
Anton edited this page Dec 26, 2019 · 2 revisions

Imports can be used to generate @typedef {import('packageName').Type} in JavaScript source code to make types available for hints. They are also used in documentation to link to external API docs and add titles to imported names.

Import extends Type: A representation of an import.

Name Type & Description Initial
constructor new () => Import
Constructor method.
import boolean true
Can be used to disambiguate import from other types.
from string -
Which package (or internal module) to import the type from.
ns string -
The namespace, which can be set different to "from", e.g., from can be set to @typedefs/parser and ns to _typedefs.

Vendoring Typedefs

When a package is compiled, it will be distributed without dependencies. Therefore, imports' typedefs need to be included in the package's typedefs, to make them accessible at runtime if the dependency that they refer to does not exist.

Clone this wiki locally