Summary
With @zenstackhq/orm 3.7.0 and TypeScript native preview (tsgo), invalid select keys are rejected by the explicit FindManyArgs type, but accepted when the same object is passed directly to db.model.findMany(...).
Repro repository: https://github.com/olup/zenstack-select-typing-repro
This issue was created by Codex on human request.
Reproduction
git clone https://github.com/olup/zenstack-select-typing-repro.git
cd zenstack-select-typing-repro
npm install
# Correctly fails: explicit args type rejects the unknown select key
npm run typecheck:args
# Unexpectedly passes: direct client call accepts the same unknown select key
npm run typecheck:client
Expected behavior
Both commands should reject missingField in the select object. A direct db.resource.findMany({ select: ... }) call should be at least as strict as satisfies FindManyArgs<SchemaType, "Resource">.
Actual behavior
typecheck:args fails with:
Object literal may only specify known properties, and 'missingField' does not exist in type ...
typecheck:client exits successfully, accepting the invalid select key.
Why this matters
In an application using generated ZenStack clients, invalid select keys passed type-checking and only failed at runtime with validation errors like Unrecognized keys ... at "select".
Environment
@zenstackhq/orm: 3.7.0
@zenstackhq/schema: 3.7.0
@typescript/native-preview: 7.0.0-dev.20260517.1
- Runtime schema copied from a generated ZenStack v3 schema
Summary
With
@zenstackhq/orm3.7.0 and TypeScript native preview (tsgo), invalidselectkeys are rejected by the explicitFindManyArgstype, but accepted when the same object is passed directly todb.model.findMany(...).Repro repository: https://github.com/olup/zenstack-select-typing-repro
This issue was created by Codex on human request.
Reproduction
Expected behavior
Both commands should reject
missingFieldin theselectobject. A directdb.resource.findMany({ select: ... })call should be at least as strict assatisfies FindManyArgs<SchemaType, "Resource">.Actual behavior
typecheck:argsfails with:typecheck:clientexits successfully, accepting the invalidselectkey.Why this matters
In an application using generated ZenStack clients, invalid
selectkeys passed type-checking and only failed at runtime with validation errors likeUnrecognized keys ... at "select".Environment
@zenstackhq/orm: 3.7.0@zenstackhq/schema: 3.7.0@typescript/native-preview: 7.0.0-dev.20260517.1