import type { GetDocumentTypeMapGen } from '@contentlayer2/core' import type { LocalDocument } from '../../types.js' import type { FieldDefType } from './index.js' export type ComputedField = { description?: string type: FieldDefType resolve: ComputedFieldResolver } // TODO come up with a way to hide computed fields from passed in document type ComputedFieldResolver = ( _: GetDocumentTypeGen, ) => any | Promise type GetDocumentTypeGen = Name extends keyof GetDocumentTypeMapGen ? GetDocumentTypeMapGen[Name] : LocalDocument // type GetDocumentTypeGen = GetDocumentTypeMapGen[Name]