Skip to content

tsgo accepts invalid select keys on ZenStack client calls (with repro repo) #2719

@olup

Description

@olup

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions