Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

How to define TS for access and others thing?

default discord avatar
IRediTOTO2 years ago
1 1

Hi, I am trying define typescript for access in CollectionConfig

const User = CollectionConfig={
...
access: {
    read: ({ req: { user } }) => {  // How to define ts for user var here ?
      return true;
    },
  },
  ...

}
  • Selected Answer
    discord user avatar
    JessChowdhury
    2 years ago

    Hi @IRediTOTO - this blog post should get you on track!

    After running payload generate:types you should be able to import user from your generated types file and use this in your code above.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.