docs: add tsconfig aliasing to generating types docs
This commit is contained in:
@@ -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'),
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user