docs: add tsconfig aliasing to generating types docs

This commit is contained in:
Elliot DeNolf
2023-02-07 14:23:58 -05:00
parent cff6608996
commit 777794583c

View File

@@ -77,15 +77,31 @@ export interface Post {
```
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
{
"compilerOptions": {
// ...
"paths": {
"payload/generated-types": [
"./src/payload-types.ts", // Ensure this matches the path to your typescript outputFile
],
}
},
// ...
}
```
#### Customizing the output path of your generated types
You can specify where you want your types to be generated by adding a property to your Payload config:
```
```ts
{
// the remainder of your config
typescript: {
outputFile: path.resolve(__dirname, './generated-types.ts'),
outputFile: path.resolve(__dirname, './payload-types.ts'),
},
}
```