Skip to content

The inferred type of X cannot be named without a reference to ark/util when using Brand-Type #1577

@muuvmuuv

Description

@muuvmuuv

Report a bug

🔎 Search Terms

Using "Branded types" (https://arktype.io/docs/expressions#brand) results in a type error that was fixed in the past here (#1031 and #1049).

The inferred type of 'GraphqlIdentifier' cannot be named without a reference to '.pnpm/@ark+util@0.56.0/node_modules/@ark/util'. This is likely not portable. A type annotation is necessary.ts(2742)

Possible solutions are installing the EXACT same version and semver range as arktype uses from the locally installed package.

pnpm add -w "@ark/util@$(cat ./node_modules/arktype/package.json | yq -r '.dependencies."@ark/util"')"

🧩 Context

  • ArkType version: ^2.1.29
  • TypeScript version (5.1+): 5.9.3
  • Other context you think may be relevant (JS flavor, OS, etc.): pnpm workspace

🧑‍💻 Repro

Playground Link: https://arktype.io/playground

import { type } from 'arktype'

export const GraphqlIdentifier = type('string.lower#GID')

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions