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
- Conditionally loading an analytics moduleAdvanced Modules · advanced
- Accessing non-existent exports from a dynamic importAdvanced Modules · advanced
- Using import type for interfacesAdvanced Modules · advanced
- Mixing type and value imports inlineAdvanced Modules · advanced
- Attempting to use a type-only import as a valueAdvanced Modules · advanced
- Default importing a CommonJS moduleAdvanced Modules · advanced