Importing types
Default export alias
/**
* @typedef {import('./Foo').default} Bar
*/
Aliases the default export type. Names it Bar without a runtime import. See import types.
Named import
/** @import { Bar } from './Foo.js' */
Imports a named type without runtime code. TypeScript 5.5+ supports this for Bar; see the 5.5 release notes.
Default import
/** @import { default as Bar } from './Foo.js' */
Imports the default export as an alias. Use this when you need a named type. See import types.
Related links
- JSDoc-supported types (typescriptlang.org)
- TypeScript 5.5 release notes (devblogs.microsoft.com)
0 Comments for this cheatsheet. Write yours!