Skip to content

Bun-specific TypeScript error with string.url submodule reference #376

Description

@yamcodes

In Bun environments, using "string.url" directly in arkenv config causes a TypeScript error:

Type '"string.url"' is not assignable to type '"Reference to submodule 'string.url' must specify an alias"'.

Current behavior:

import arkenv from "arkenv";

const env = arkenv({
  TURSO_DATABASE_URL: "string.url", // ❌ TypeScript error in Bun
});

Expected behavior:
Should work the same as in Node.js, where "string.url" is accepted without errors.

Environment:

  • ✅ Works in Node.js v24
  • ❌ Fails in Bun v1.2.22 and v1.3.2
  • Type-level issue only (runtime validation works correctly)

Workaround:
Users can use "string.url" as "string" or import type from arktype directly, but this shouldn't be necessary.

Root cause identified: This issue occurs when tsconfig.json uses module: "commonjs". See #378 for the consolidated issue.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    arkenvChanges to the `arkenv` npm package.bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions