breautek commented on issue #266:
URL:
https://github.com/apache/cordova-plugin-media-capture/issues/266#issuecomment-1382898018
According to the error the type is a union type of `MediaFile[] |
CaptureError`, not `MediaFile[]`
Therefore you must declare your type as a union type to match and do the
appropriate checks to isolate the union type, e.g:
```
if (data instanceof Array) {
// Typescript can assume data is of type MediaFile[] in this block
}
else {
// Typescript can assume the type is CaptureError
}
```
Note that while your plugin appears to share the same name as this plugin,
it doesn't appear to be the same as this plugin as these typings do not match
this plugin's
[typings](https://github.com/apache/cordova-plugin-media-capture/blob/65099a34a987dd2a86dc8bc5b2b764387a76b305/types/index.d.ts#L40).
It is likely that ionic, or the maintainers of
`@awesome-cordova-plugins/media-capture/ngx` is what is producing this
alternate API. Therefore if you have further issues or questions, it may be
best to ask them directly.
Closing as this does not appear to be related to Cordova.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]