Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Generating A Barrel File

Sometimes it is useful to keep one or many barrel files in a typescript project, to make it easier to import/export elements from a group of modules.

Sketch has a dedicated command to make this process easier.

Examples

Target directory:

tests/ts_barrel
└── nested
    ├── file1.ts
    └── nested2
        └── file2.ts

Command:

sketch ts barrel

Output:

export * from "nested/file1";
export * from "nested/nested2/file2";