SIGN IN SIGN UP
payloadcms / payload UNCLAIMED

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.

0 0 16 TypeScript

feat(sdk): automatically fallback to generated types attempt (#15167)

### Before

You had to manually pass `GeneratedTypes` to the SDK:

```ts
import { PayloadSDK } from '@payloadcms/sdk'
import type { Config } from './payload-types'

const sdk = new PayloadSDK<Config>({})
```

### After

The SDK automatically uses your generated types via module augmentation
- just like the Payload Local API. If your project has a
`payload-types.ts`, the types are picked up automatically:

```ts
import { PayloadSDK } from '@payloadcms/sdk'

const sdk = new PayloadSDK({}) // Types inferred automatically
```

You can still pass a custom type if needed.

This PR also removes a lot of duplicated types between sdk and payload,
by allowing the payload types to accept an optional `TGeneratedTypes`
generic.
A
Alessio Gravili committed
ae50d3943d88e79a3e5733250447a178572f405f
Parent: 6c1109f
Committed by GitHub <noreply@github.com> on 1/13/2026, 1:52:00 AM