-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
arkenvChanges to the `arkenv` npm package.Changes to the `arkenv` npm package.exampleIssues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory)Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory)
Description
This doesn't work in ArkEnv (and ArkType):
Based on the docs we should use pipes:
https://arktype.io/docs/objects#properties-defaultable
But this is not clearly possible with ArkEnv (See #162)
Also, based on this, you would expect this to work:
import arkenv, { type } from "arkenv";
const Thing = arkenv({
array: type("number.integer[]").default(() => []),
});Instead, we are getting:
Type '[Type<number[], { string: Submodule<{ root: string; " arkInferred": string; trim: Submodule<$ & { " arkInferred": (In: string) => To<string>; }>; normalize: Submodule<$ & { " arkInferred": (In: string) => To<...>; }>; ... 19 more ...; host: string; }>; number: Submodule<...>; }>, "=", () => never[]]' is not assignable to type 'string'.ts(2322)
I think that createEnv is defined in a way that does not allow an internal type, and the issue is probably not in the type we export since this works:
import arkenv, { type } from "arkenv";
const Thing = type({
array: type("number.integer[]").default(() => []),
});More specifically the signature (i/o) of the createEnv function is probably insufficient.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
arkenvChanges to the `arkenv` npm package.Changes to the `arkenv` npm package.exampleIssues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory)Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory)