Recall & Review
beginner
What is the syntax to export a single variable in TypeScript?
Use <code>export const variableName = value;</code> to export a single variable.Click to reveal answer
beginner
How do you export multiple variables or functions at once?
Use
export { name1, name2, name3 }; to export multiple items together.Click to reveal answer
intermediate
What is the difference between default export and named export?
Default export exports a single value per file using
export default. Named exports export multiple values by name using export.Click to reveal answer
intermediate
How do you rename an export while exporting it?
Use
export { originalName as newName }; to rename an export.Click to reveal answer
intermediate
How do you re-export everything from another module?
Use
export * from './module'; to re-export all exports from another file.Click to reveal answer
Which syntax exports a default function in TypeScript?
✗ Incorrect
The correct syntax for default export of a function is
export default function myFunc() {}.How do you export multiple variables named a and b together?
✗ Incorrect
Use curly braces to export multiple named variables:
export { a, b };.What does
export * from './file'; do?✗ Incorrect
This syntax re-exports all exports from another module.
How to rename export 'foo' to 'bar' while exporting?
✗ Incorrect
Use
export { foo as bar }; to rename an export.Which is NOT a valid export syntax?
✗ Incorrect
Functions must have a name when exported as named exports.
export function() {} is invalid.Explain the difference between named exports and default exports in TypeScript.
Think about how you import them too.
You got /3 concepts.
Describe how to re-export all exports from another module and why it might be useful.
Imagine combining exports from many files into one.
You got /3 concepts.