Complete the code to export a function from a module.
export function [1]() { console.log('Hello from module'); }
The function name must be provided after export function to make it available outside the module.
Complete the code to import the exported function from a module.
import { [1] } from './greetings'; [1]();
You import the function by the exact name it was exported with, here greet.
Fix the error in the module export syntax.
export [1] greet() { console.log('Hi'); }
The correct keyword to declare a function is function. Other options are invalid in TypeScript.
Fill both blanks to create a named export and import it correctly.
export [1] [2] = 42;
You export a constant using export const and give it a name like answer to import later.
Fill all three blanks to export a default class and import it with a custom name.
export default class [1] { greet() { console.log('Hello'); } } import [2] from './Greeter'; const greeter = new [3](); greeter.greet();
The class is named Greeter when exported as default. You can import it with any name, here MyGreeter, and use that name to create an instance.