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:
Elliot DeNolf
2024-06-10 13:42:44 -04:00
committed by GitHub
parent 45e86832c2
commit 7309d474ee
81 changed files with 743 additions and 39 deletions

View File

@@ -11,6 +11,7 @@ export interface Config {
posts: Post;
'relation-a': RelationA;
'relation-b': RelationB;
'pg-migrations': PgMigration;
'custom-schema': CustomSchema;
users: User;
'payload-preferences': PayloadPreference;
@@ -87,6 +88,40 @@ export interface RelationB {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "pg-migrations".
*/
export interface PgMigration {
id: string;
relation1?: (string | null) | RelationA;
myArray?:
| {
relation2?: (string | null) | RelationB;
mySubArray?:
| {
relation3?: (string | null) | RelationB;
id?: string | null;
}[]
| null;
id?: string | null;
}[]
| null;
myGroup?: {
relation4?: (string | null) | RelationB;
};
myBlocks?:
| {
relation5?: (string | null) | RelationA;
relation6?: (string | null) | RelationB;
id?: string | null;
blockName?: string | null;
blockType: 'myBlock';
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "custom-schema".
@@ -116,6 +151,7 @@ export interface CustomSchema {
| null;
updatedAt: string;
createdAt: string;
_status?: ('draft' | 'published') | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema