TypeScript

Mixing type and value imports inline in TypeScript

TypeScriptAdvanced Modulesimport type vs importadvanced

What this snippet does

Inline 'type' modifiers allow importing values and types from the same module while ensuring types are stripped by the transpiler.

Expected output

Compile Error: Cannot use 'createUser' before initialization.

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 →