UNPKG

moysklad-api-model

Version:

Объектная модель API МойСклад для TypeScript проектов

17 lines (16 loc) 1.09 kB
import type { OptionalNullablePartial } from '../tools'; import type { CollectionRef } from './CollectionRef'; import type { Document, DocumentExpand, DocumentPatch } from './Document'; import type { EntityRef } from './EntityRef'; import type { DocumentPositionType } from './Position'; import type { Patch } from './utils'; export type DocumentWithPositionsMetaType = keyof DocumentPositionType; export type DocumentWithPositionsFields<T extends DocumentWithPositionsMetaType> = { store?: EntityRef<'store'>; positions: CollectionRef<DocumentPositionType[T]>; }; export type DocumentWithPositions<T extends DocumentWithPositionsMetaType> = Document<T> & DocumentWithPositionsFields<T>; export type DocumentWithPositionsExpand<T extends DocumentWithPositionsMetaType> = Pick<DocumentWithPositionsFields<T>, 'positions' | 'store'> & DocumentExpand<T>; export type DocumentWithPositionsPatch<T extends DocumentWithPositionsMetaType> = DocumentPatch & OptionalNullablePartial<Pick<DocumentWithPositionsFields<T>, 'store'>> & Partial<{ positions: Patch<DocumentPositionType[T]>[]; }>;