Better typescript types
D-Sketon opened this issue · comments
Check List
- I have already read README.
- I have already searched existing issues.
- I have already searched existing pull requrests.
Feature Request
There are still some problems with the current type labeling for warehouses. For example:
warehouse/src/types/virtual.ts
Line 17 in 83df5a1
Actually, it should be:
get(fn: (this: Document<T>) => any): SchemaTypeVirtual<T> {}
However, it is difficult to refactor the type due to the following implementations:
Lines 19 to 23 in 83df5a1
Additional context
No response
One possible solution is to redefine a new type, e.g:
type DocumentType<T> = Document<T> & T
Then replace Document<T>
with DocumentType<T>
wherever it needs to be used.
But this could be a big change.