Closed totolicious closed 6 months ago
DefinitelyTyped typings are community-maintained. Initially, I published the typings file generated from JSDoc comments with the ImapFlow package. Unfortunately, the auto-generated typings were incorrect. I did not want to manually edit the typings file every time I published a new ImapFlow version, so I removed the reference from package.json. Then someone else took over and started publishing typings to the DeifnitelyTyped repository. As I have nothing to do with these typings, I can't help solving this issue.
@andris9 You can add the types to this project, so DefinitelyTyped is not even needed.
This solved typescript errors for me, although you could go into more details based on disposition type.
Describe the bug The properties
dispositionParameters
andparameters
of interfaceMessageStructureObject
have wrong types. Currently, these properties have thestring
type, although both the documentation and the actual data returned by the libraryfetch
method will return objects with string properties for bothdispositionParameters
andparameters
.Example
bodyStructure
(of typeMessageStructureObject
) of aFetchMessageObject
.The problem & the fix: The types found in DefinitelyTyped are wrong. See this for the fix: https://github.com/DefinitelyTyped/DefinitelyTyped/commit/e8dd2e509036c91c0970daf96377c2d2df8cf136 I'm 100% sure how to contribute with the fix though 😅
To Reproduce
To see the actual values returned by the lib:
Documentation clearly says that these are objects
@types/imapflow types: MessageStructureObject['dispositionParameters'] : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/imapflow/index.d.ts#L362 MessageStructureObject['parameters']: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/imapflow/index.d.ts#L356
Expected behavior The two
string
should be{ [k: string]: string }
Screenshots Dump of an example bodyStructure
Typescript Error when accessing
parameters
ordispositionParameters
Desktop (please complete the following information):
Additional context Add any other context about the problem here.