Skip to content

Fix type() function returning any instead of preserving types #375

Description

@yamcodes

The type() function from arkenv always returns any when wrapping type definitions, which breaks type inference.

Current behavior:

import arkenv, { type } from "arkenv";

const env = arkenv({
  TURSO_DATABASE_URL: type("string.url"), // types as 'any' instead of 'string'
});

Expected behavior:
The type() function should preserve the underlying type, so type("string.url") should result in a string type (not any).

Impact:

  • Users lose type safety when using type() wrapper
  • Forces workarounds like type assertions or importing type from arktype directly
  • Only affects Bun, this does not happen in Node

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