You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This does not seem to work for me in version 3 beta-117. It keeps using the old type, however if I cast the type directly then it works, but the original type is not extended but replaced instead.
import { RequestContext } from 'payload'
...
read: (args) => {
let contextFromArgs = args.req.context;
contextFromArgs.myObject; // does not recognize myObject
let explicitContext: RequestContext;
explicitContext.myObject; // works but the type is completely replaced, not augmented
},
...
To reproduce, I used multi-tenant example from the beta branch.
Create a file types.d.ts in the root directory with the content described in the official docs, and try to access the context from any hook using args.req.context.myObject.
Which area(s) are affected? (Select all that apply)
Describe the Bug
https://payloadcms.com/docs/beta/hooks/context#typescript
This does not seem to work for me in version 3
beta-117
. It keeps using the old type, however if I cast the type directly then it works, but the original type is not extended but replaced instead.Link to the code that reproduces this issue
https://github.com/payloadcms/payload/tree/beta/examples/multi-tenant
Reproduction Steps
To reproduce, I used
multi-tenant
example from thebeta
branch.Create a file
types.d.ts
in the root directory with the content described in the official docs, and try to access the context from any hook usingargs.req.context.myObject
.Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Binaries:
Node: 20.11.0
npm: 10.2.4
Yarn: 1.22.19
pnpm: 9.12.2
Relevant Packages:
payload: 3.0.0-beta.112
next: 15.0.0-canary.173
@payloadcms/db-mongodb: 3.0.0-beta.112
@payloadcms/graphql: 3.0.0-beta.112
@payloadcms/next/utilities: 3.0.0-beta.112
@payloadcms/richtext-lexical: 3.0.0-beta.112
@payloadcms/translations: 3.0.0-beta.112
@payloadcms/ui/shared: 3.0.0-beta.112
react: 19.0.0-rc-3edc000d-20240926
The text was updated successfully, but these errors were encountered: