feat!: type auto-generation (#6657)
Types are now auto-generated by default.
You can opt-out of this behavior by setting:
```ts
buildConfig({
// Rest of config
typescript: {
autoGenerate: false
},
})
```
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'path'
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||
@@ -244,4 +248,7 @@ export default buildConfigWithDefaults({
|
||||
})
|
||||
}
|
||||
},
|
||||
typescript: {
|
||||
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import type { AuthStrategyFunction } from 'payload/auth.js'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import path from 'path'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
|
||||
import type { AuthStrategyFunction } from 'payload/auth'
|
||||
|
||||
import { buildConfigWithDefaults } from '../../buildConfigWithDefaults.js'
|
||||
import { usersSlug } from './shared.js'
|
||||
@@ -78,4 +84,7 @@ export default buildConfigWithDefaults({
|
||||
],
|
||||
},
|
||||
],
|
||||
typescript: {
|
||||
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -44,10 +44,10 @@ export interface User {
|
||||
saveToJWTString?: string | null;
|
||||
saveToJWTFalse?: string | null;
|
||||
};
|
||||
saveToJWTTab: {
|
||||
saveToJWTTab?: {
|
||||
test?: string | null;
|
||||
};
|
||||
tabSaveToJWTString: {
|
||||
tabSaveToJWTString?: {
|
||||
includedByDefault?: string | null;
|
||||
};
|
||||
tabLiftedSaveToJWT?: string | null;
|
||||
@@ -156,6 +156,6 @@ export interface PayloadMigration {
|
||||
|
||||
|
||||
declare module 'payload' {
|
||||
// @ts-ignore
|
||||
// @ts-ignore
|
||||
export interface GeneratedTypes extends Config {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user