Skip to content

Export

Jurassic exports code cells tagged with //| export comment into corresponding ts modules. Code cells with Deno tests are grouped into test module (This is likely to change in the future when this gets fixed).

Let's use a few examples to illustrate how exports work assuming we are looking at the cells within foo.ipynb

ts
//| export

export const bar = () => "hey";

converts to foo.ts with

ts
export const bar = () => "hey";

If you need to share code between different cells, make sure to use //| export in both:

ts
//| export
const foo = () => "foo";
ts
//| export

export const bar = () => foo();

Notice how both cells are tagges with //| export to make sure both pieces of code make it to the final foo.ts module.

Keep in mind, //| export tag does not automatically export actual ts function/class/type, it merely moves it to the target ts module. You are responsible for managing visibility of the code using export TS keyword.

exportNb

typescript
const exportNb = (notebookPath: string | undefined, config: Config | undefined) => Promise<void>