Grokking TypeScript
Vote

0% completed

​

Default and Named Exports

These two import lines differ only by a pair of curly braces, but they ask for different things:

import { capitalize } from "./stringUtils"; import formatDate from "./dateFormatter";

The first line asks a module for its export named capitalize, and the name must match. The second asks a module for its default export, and the importing file chooses the local name. These are the two kinds of export in TypeScript: named exports and default exports. This lesson follows one text module and one date module through both.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content