-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Template): add Template utility
- Loading branch information
Showing
5 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { Document, DocumentMetaType } from '../Document' | ||
|
||
// TODO Указать конкретные типы документов которые можно создавать этим методом | ||
|
||
// TODO API гибок и позволяет отправлять при создании объекта не обязательные | ||
// и лишние поля. В типах нельзя позволять такую вольность, хотя на практике | ||
// подобное может быть удобно. | ||
|
||
// Другими словами, при получении шаблона его необходимо будет деструктурировать | ||
// в случае, когда шаблон ынужно обогащать доп. данными | ||
|
||
/** | ||
* Шаблон нового документа `/entity/{type}/new` | ||
*/ | ||
export type Template<T extends Document<DocumentMetaType>> = Omit< | ||
T, | ||
'meta' | 'id' | 'accountId' | 'updated' | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import type { CustomerOrder, Template } from '../../../src' | ||
|
||
const t1 = {} as Template<CustomerOrder> | ||
|
||
// @ts-expect-error | ||
t1.id | ||
|
||
t1.agent.meta |