TypeScript

Typing a dynamic import in TypeScript

TypeScriptAdvanced ModulesDynamic import()advanced

What this snippet does

Dynamic imports return a Promise typed with the module's exports, enabling code splitting and lazy loading.

Expected output

defined

Why practise typing this

Typing advanced modules code builds muscle memory for the symbols and indentation TypeScript uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More TypeScript practice

Browse all TypeScript snippets →