docs: removes generated type aliasing
Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
This commit is contained in:
@@ -17,9 +17,12 @@ The Payload Admin panel is built with Webpack, code-split, highly performant (ev
|
||||
editors.
|
||||
</Banner>
|
||||
|
||||

|
||||
|
||||
_Screenshot of the Admin panel while editing a document from an example `AllFields` collection_
|
||||
<LightDarkImage
|
||||
srcLight="https://payloadcms.com/images/docs/admin.jpg"
|
||||
srcDark="https://payloadcms.com/images/docs/admin-dark.jpg"
|
||||
alt="Admin panel with collapsible sidebar"
|
||||
caption="Redesigned admin panel with a collapsible sidebar that's open by default, providing greater extensibility and enhanced horizontal real estate."
|
||||
/>
|
||||
|
||||
## Admin Options
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ keywords: headless cms, typescript, documentation, Content Management System, cm
|
||||
|
||||
While building your own custom functionality into Payload, like plugins, hooks, access control functions, custom routes, GraphQL queries / mutations, or anything else, you may benefit from generating your own TypeScript types dynamically from your Payload config itself.
|
||||
|
||||
### Types generatation script
|
||||
### Types generation script
|
||||
|
||||
Run the following command in a Payload project to generate types based on your Payload config:
|
||||
|
||||
@@ -18,33 +18,12 @@ payload generate:types
|
||||
|
||||
You can run this command whenever you need to regenerate your types, and then you can use these types in your Payload code directly.
|
||||
|
||||
### Configuration
|
||||
|
||||
In order for Payload to properly infer these types when using local operations, you'll need to alias the following in your tsconfig.json file:
|
||||
|
||||
```json
|
||||
// tsconfig.json
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
// ...
|
||||
"paths": {
|
||||
"payload/generated-types": [
|
||||
"./src/payload-types.ts" // Ensure this matches the path to your typescript outputFile
|
||||
]
|
||||
}
|
||||
}
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
#### Custom output file path
|
||||
### Custom output file path
|
||||
|
||||
You can specify where you want your types to be generated by adding a property to your Payload config:
|
||||
|
||||
```ts
|
||||
// payload.config.ts
|
||||
|
||||
{
|
||||
// ...
|
||||
typescript: {
|
||||
|
||||
Reference in New Issue
Block a user