0
0
Typescriptprogramming~10 mins

Type-only imports and exports in Typescript - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import only the type User from the module.

Typescript
import [1] { User } from './models';
Drag options to blanks, or click blank then click option'
Atype
Bconst
Clet
Dvar
Attempts:
3 left
💡 Hint
Common Mistakes
Using const, let, or var instead of type.
Omitting the type keyword and importing as a normal import.
2fill in blank
medium

Complete the code to export only the type Config from this module.

Typescript
export [1] { Config };
Drag options to blanks, or click blank then click option'
Aconst
Bfunction
Ctype
Dclass
Attempts:
3 left
💡 Hint
Common Mistakes
Using export const or other runtime exports instead of export type.
Forgetting to specify type and exporting as a normal export.
3fill in blank
hard

Fix the error in the import statement to import only the type Product.

Typescript
import { [1] Product } from './inventory';
Drag options to blanks, or click blank then click option'
Avar
Bconst
Clet
Dtype
Attempts:
3 left
💡 Hint
Common Mistakes
Placing type after the braces or omitting it.
Using runtime import keywords like const inside braces.
4fill in blank
hard

Fill both blanks to import only the types Order and Customer from the module.

Typescript
import [1] { Order, [2] Customer } from './sales';
Drag options to blanks, or click blank then click option'
Atype
Bconst
Dlet
Attempts:
3 left
💡 Hint
Common Mistakes
Using runtime import keywords like const or let.
Omitting type before the second type.
5fill in blank
hard

Fill all three blanks to export only the types Settings, Theme, and Layout.

Typescript
export [1] { Settings, [2] Theme, [3] Layout };
Drag options to blanks, or click blank then click option'
Atype
Bconst
Attempts:
3 left
💡 Hint
Common Mistakes
Using runtime export keywords like const.
Omitting type before some type names.