Skip to content

Commit

Permalink
fix: add document name to type in sanity typer
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilym committed Oct 7, 2024
1 parent 6787616 commit 0a8294b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/sanity-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type SanityFieldTypeMap = {
text: string;
number: number;
boolean: boolean;
date: Date;
date: string;
reference: unknown;
object: Record<string, UnknownFieldType>;
// TODO: add support for typing arrays
Expand Down Expand Up @@ -115,9 +115,13 @@ export type GenericSchemaType<
[Field in Fields[number] as Field['name']]: FieldTypeMap<CustomFieldTypeMap>[Field['type']];
};

export type DocumentFields = {
export type DocumentSchema = {
name: string;
};

export type DocumentFields<Document extends DocumentSchema> = {
_id: string;
_type: string;
_type: Document['name'];
_createdAt: string;
_updatedAt: string;
_rev: string;
Expand Down

0 comments on commit 0a8294b

Please sign in to comment.