Recall & Review
beginner
What is a default export in TypeScript?
A default export is a single value or entity that a module exports as its main thing. When importing, you can name it anything you want.
Click to reveal answer
beginner
How do you import a default export?You import a default export using the syntax: <code>import anyName from './module'</code>. The name can be anything you choose.Click to reveal answer
beginner
What are named exports?
Named exports allow a module to export multiple values by name. When importing, you must use the exact exported names inside curly braces.
Click to reveal answer
beginner
How do you import named exports?You import named exports using the syntax: <code>import { name1, name2 } from './module'</code>. The names must match exactly.Click to reveal answer
intermediate
Can a module have both default and named exports?
Yes, a module can have one default export and multiple named exports at the same time.
Click to reveal answer
Which syntax imports a default export from a module?
✗ Incorrect
Default exports are imported without curly braces using any name you choose.
How do you import a named export called 'foo'?
✗ Incorrect
Named exports must be imported using curly braces with the exact exported name.
Can you rename a default import when importing?
✗ Incorrect
Default imports can be named anything during import.
Which statement is true about named exports?
✗ Incorrect
Named exports require exact names and curly braces when importing.
Is this valid?
export default function() {} and export const foo = 5; in the same file?✗ Incorrect
Modules can have one default export and many named exports together.
Explain the difference between default exports and named exports in TypeScript.
Think about how you import and name things from a module.
You got /4 concepts.
Describe how you would import both a default export and named exports from the same module.
Remember the syntax differences for default and named imports.
You got /4 concepts.