UNPKG

@stackbit/sdk

Version:
26 lines 1.72 kB
/** * This file extends the Stackbit schema with an "unknown" field type. * The "unknown" field type is used in intermediate steps when generating a new * schema from content files */ import { Field, FieldType, FieldCommonProps, FieldObject, FieldObjectProps, FieldModelProps, FieldList, FieldListProps, FieldStyle, FieldListItems } from '@stackbit/types'; export type FieldWithUnknown = Exclude<Field, FieldObject | FieldStyle | FieldList> | FieldUnknown | FieldObjectWithUnknown | FieldListWithUnknown; export type FieldUnknown = FieldCommonProps & FieldUnknownProps; export type FieldObjectWithUnknown = FieldCommonProps & FieldObjectPropsWithUnknown; export type FieldListWithUnknown = FieldCommonProps & FieldListPropsWithUnknown; export type FieldTypeWithUnknown = 'unknown' | FieldType; export interface FieldUnknownProps { type: 'unknown'; } export type FieldObjectPropsWithUnknown = Omit<FieldObjectProps, 'fields'> & { fields: FieldWithUnknown[]; }; export type FieldListPropsWithUnknown = Omit<FieldListProps, 'items'> & { items: FieldListItemsWithUnknown; }; export type FieldListItemsWithUnknown = Exclude<FieldListItems, FieldObjectProps> | FieldUnknownProps | FieldObjectPropsWithUnknown; export declare function isObjectWithUnknownField(field: FieldWithUnknown): field is FieldObjectWithUnknown; export declare function isListWithUnknownField(field: FieldWithUnknown): field is FieldListWithUnknown; export declare function isObjectListItemsWithUnknown(items: FieldListItemsWithUnknown): items is FieldObjectPropsWithUnknown; export declare function isModelListItemsWithUnknown(items: FieldListItemsWithUnknown): items is FieldModelProps; //# sourceMappingURL=analyze-schema-types.d.ts.map