Closed jeserkin closed 3 years ago
What would
properties
type be, to accommodate provided method?
Partial<IEmailGetArguments>
maybe?
If I understand correctly, properties should be used with ...properties
instead of properties
Okay. So destructuring is not an option here, since there should be a property called properties
.
Based on https://github.com/linagora/jmap-client-ts/blob/main/src/types.ts#L224-L230 and https://github.com/linagora/jmap-client-ts/blob/main/src/types.ts#L48-L51 it is unclear how this can be passed as an argument.
Partial
doesn't seem to work as well.
I feel like it is difficult to define it type as method argument because it is marked as keyof
, but I can be wrong about it.
This doesn't work?
(keyof IEmailProperties)[]
As argument type?
Instead of the ?
on your first example.
Okay. Didn't not expect, that it will work. Thanks. That resolved the issue.
Do we have code examples that could serve as documentation?
If you did not find it yourself, then others are likely not to find it too...
I guess only current discussion could serve as documentation for this specific example/problem, but I do support idea of Wiki page with example for different existing methods.
Do we have code examples that could serve as documentation?
If you did not find it yourself, then others are likely not to find it too...
This is more typescript advanced types problems than jmap-client-ts problems.
Also true, but still would be nice to have examples (Wiki on GitHub is a perfect place for it). Entirely possible, that my use case came up because of lack of knowledge about certain TypeScript aspect.
Given
What would
properties
type be, to accommodate provided method?Based on the question, it seems to me, that
properties?: (keyof Properties)[];
is not the desired way of specifying type.