November 2019
Beginner
804 pages
20h 1m
English
In the previous example, we showed that the export keyword can be used inline to export a symbol. It is also possible to use export statements to export one or more symbols.
This can be useful to rename things, as shown:
interface Thing {
name: string
}
// 1
export {
Thing
}
// 2
export {
Thing as RenamedThing
}
The first export simply exports the symbol with its original name, while the second one exports it under a different name, using the as keyword.
Also, just like with ES modules, each module can have a default export using the export default foo syntax. This is recommended by the TypeScript team if you only export one symbol, as it makes it easier on the consumer side.
Finally, in a module, it is possible to export ...
Read now
Unlock full access