Emitted contract.d.ts does not match contract shape in RC 13/10
Author: RyanGarberCreated Sep 13, 2026Updated Sep 15, 2026
Package and version
[email protected], @prisma/[email protected]
What happened?
The contract.d.ts emitted by the Prisma CLI (RC 13) is missing nullable fields in every to-one relation, causing type errors because the new contract shape requires the field to be present.
What did you expect to happen?
The CLI emits the correct shape (nullable fields present in every relation in the contract.d.ts) or the fields made truly optional at call sites.
Minimal reproduction
- Create a new project with any to-one relations (e.g.
model ModelA { related ModelB ... }) - Inspect the emitted
contract.d.tsforreadonly nullablein the relation's schema or pass the emitted schema toDefaultModelRowas a type argument and typecheck
Environment
- Node 24.14.0
- pnpm 12.3.4
- macOS 27 Developer Preview
- Postgres 18.4
Additional context
Result from passing the emitted contract to DefaultModelRow<Contract...>:
error TS2344: Type 'Contract' does not satisfy the constraint 'Contract<SqlStorage<string>>'.
The types of 'domain.namespaces' are incompatible between these types.
Type '{ readonly public: { readonly models: { readonly Account: { readonly fields: { readonly id: { readonly nullable: false; readonly type: { readonly kind: "scalar"; readonly codecId: "pg/text@1"; }; }; readonly accountId: { readonly nullable: false; readonly type: { ...; }; }; ... 10 more ...; readonly updatedAt: { ......' is not assignable to type 'Readonly<Record<string, ApplicationDomainNamespace>>'.
Property 'public' is incompatible with index signature.
Type '{ readonly models: { readonly Account: { readonly fields: { readonly id: { readonly nullable: false; readonly type: { readonly kind: "scalar"; readonly codecId: "pg/text@1"; }; }; readonly accountId: { readonly nullable: false; readonly type: { ...; }; }; ... 10 more ...; readonly updatedAt: { ...; }; }; readonly re...' is not assignable to type 'ApplicationDomainNamespace'.
Types of property 'models' are incompatible.
Type '{ readonly Account: { readonly fields: { readonly id: { readonly nullable: false; readonly type: { readonly kind: "scalar"; readonly codecId: "pg/text@1"; }; }; readonly accountId: { readonly nullable: false; readonly type: { readonly kind: "scalar"; readonly codecId: "pg/text@1"; }; }; ... 10 more ...; readonly upd...' is not assignable to type 'Record<string, ContractModelBase<Readonly<Record<string, unknown>>>>'.
Property 'Account' is incompatible with index signature.
Type '{ readonly fields: { readonly id: { readonly nullable: false; readonly type: { readonly kind: "scalar"; readonly codecId: "pg/text@1"; }; }; readonly accountId: { readonly nullable: false; readonly type: { readonly kind: "scalar"; readonly codecId: "pg/text@1"; }; }; ... 10 more ...; readonly updatedAt: { ...; }; };...' is not assignable to type 'ContractModelBase<Readonly<Record<string, unknown>>>'.
Types of property 'relations' are incompatible.
Type '{ readonly user: { readonly to: { readonly namespace: "public" & { readonly __brand: "NamespaceId"; }; readonly model: "User"; }; readonly cardinality: "N:1"; readonly on: { readonly localFields: readonly ["userId"]; readonly targetFields: readonly [...]; }; }; }' is not assignable to type 'Record<string, ContractRelation>'.
Property 'user' is incompatible with index signature.
Type '{ readonly to: { readonly namespace: "public" & { readonly __brand: "NamespaceId"; }; readonly model: "User"; }; readonly cardinality: "N:1"; readonly on: { readonly localFields: readonly ["userId"]; readonly targetFields: readonly [...]; }; }' is not assignable to type 'ContractRelation'.
Property 'nullable' is missing in type '{ readonly to: { readonly namespace: "public" & { readonly __brand: "Names
Source: prisma/prisma