Skip to content

c.env.* typed as unknown after void prepare #53

Description

@totallynotdavid

dependencies: void: 0.9.0 | ts: 6.0.3, also 5.9.3
repo: https://github.com/totallynotdavid/void-env-repro


Even after void prepare, any env var accessed via c.env in a handler is typed as unknown despite being declared in env.ts.

TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string'.

The cause seems to be the generated .void/env.d.ts:

type_VoidEnvShape=_VoidEnvSchemaextends{default: infer D} ? D : ...;declare module "void/handler"{interfaceCloudBindingsextends_VoidEnvShape{}}

Note: this surfaces only when typeAware and typeCheck are enabled in the vite-plus lint options.

The workaround i've used:

importtype{CloudBindings}from"void/handler";declare module "void/handler"{interfaceCloudBindings{API_SECRET: string;}}

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions