docs: removes generated type aliasing

Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
This commit is contained in:
PatrikKozak
2023-10-08 10:13:03 -04:00
committed by GitHub
parent 8e0c3602f9
commit 022ef85d8c
2 changed files with 8 additions and 26 deletions

View File

@@ -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: {