Skip to content

Modules

Goal: Split code across ES modules.

SuperJS emits standard ES modules. Use named exports and explicit import paths.

Example

import { ok, err } from "@superjs/std-core"

export type UserId = string

export function parseId(raw: string): UserId {
  return raw
}

export function demo(): void {
  const r = ok(1)
  console.log(r)
}

Open in playground

Key takeaways

  • One module per file is the default.
  • Type-only imports are not required — types erase.
  • Configure paths in superjs.config.json.

Next: Async and await

Documentation