Repository navigation
Done
Labels
bugSomething isn't working
Description
Report a bug
π Search Terms
ArkEnv, scope import
π§© Context
"arktype": "2.2.1",
"@ark/schema": "0.56.0"
"typescript": "^6.0.3"
π§βπ» Repro
import { scope } from "arktype"
export const baseMeta = scope({
BaseMeta: {
"description?": "string",
}
});
/// Method #1: import
const binaryMeta1 = scope({
...baseMeta.import(),
Binary: {
"...": "BaseMeta",
popKind: "'binary'",
},
Bitwise: {
"...": "Binary",
popKind: "'bitwise'",
},
ArkMeta: "Binary | Bitwise"
}).export();
// Method #2: inline
const binaryMeta2 = scope({
BaseMeta: {
"description?": "string",
},
Binary: {
"...": "BaseMeta",
popKind: "'binary'",
},
Bitwise: {
"...": "Binary",
popKind: "'bitwise'",
},
ArkMeta: "Binary | Bitwise"
}).export();
export const ArkMeta1 = binaryMeta1.ArkMeta;
type ArkMeta1 = typeof ArkMeta1.infer;
export const ArkMeta2 = binaryMeta2.ArkMeta;
type ArkMeta2 = typeof ArkMeta2.infer;
// This causes error: Return type annotation circularly references itself ts(2577)
declare global {
interface ArkEnv {
meta(): ArkMeta1
}
}
// // This is fine:
declare global {
interface ArkEnv {
meta(): ArkMeta2
}
}Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Type
Projects
- StatusShow more project fieldsDone (merged or closed)
Activity
pullfrog commentedon Jul 30, 2026
fix(type): pass Types through scope validation without reading ArkEnvβ¦
ssalbdivad commentedon Dec 3, 2026
fixed in 3.0.0 β
scope.import()participating inArkEnv.metano longer hitsts(2577)on ts 6 or 7. note that in 3.0ArkEnvmoved fromdeclare globaltodeclare module "arktype"(https://arktype.io/docs/upgrading#arkenv-is-arktypes-not-a-global).