0
0
Typescriptprogramming~10 mins

Export syntax variations 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 export the function named greet.

Typescript
export [1] function greet() { console.log('Hello!'); }
Drag options to blanks, or click blank then click option'
Adefault
Bconst
Clet
Dvar
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable declaration keywords like const or let instead of default.
Forgetting to add export keyword.
2fill in blank
medium

Complete the code to export multiple named constants.

Typescript
export const [1] = 42, pi = 3.14;
Drag options to blanks, or click blank then click option'
Aresult
Banswer
Cvalue
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved words or invalid variable names.
Forgetting to use const keyword.
3fill in blank
hard

Fix the error in the export statement for a type alias.

Typescript
export [1] User = { name: string; age: number };
Drag options to blanks, or click blank then click option'
Aconst
Binterface
Ctype
Dclass
Attempts:
3 left
💡 Hint
Common Mistakes
Using const or class keywords for type aliases.
Confusing interface with type alias.
4fill in blank
hard

Fill both blanks to export a function and a variable together.

Typescript
export { [1], [2] };
Drag options to blanks, or click blank then click option'
Agreet
Banswer
Cresult
Dcalculate
Attempts:
3 left
💡 Hint
Common Mistakes
Using names that are not declared in the module.
Forgetting commas between names.
5fill in blank
hard

Fill all three blanks to re-export named exports from another module.

Typescript
export { [1], [2] as alias, [3] } from './module';
Drag options to blanks, or click blank then click option'
Afoo
Bbar
Cbaz
Dqux
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid names not exported by the other module.
Misplacing the as keyword.