Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some methods lack return types #468

Closed
StefanNedelchev opened this issue Apr 26, 2021 · 2 comments · Fixed by #469
Closed

Some methods lack return types #468

StefanNedelchev opened this issue Apr 26, 2021 · 2 comments · Fixed by #469
Labels

Comments

@StefanNedelchev
Copy link

I tried importing the plugin into a typescript project but I get these errors during compilation:

Error: node_modules/chartjs-plugin-zoom/types/index.d.ts:16:5 - error TS7010: 'pan', which lacks return-type annotation, implicitly has an 'any' return type.
[ng] 16     pan(pan: PanAmount, options?: Partial<PanOptions>, scales?: Scale[]);
[ng]        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] Error: node_modules/chartjs-plugin-zoom/types/index.d.ts:17:5 - error TS7010: 'zoom', which lacks return-type annotation, implicitly has an 'any' return type.
[ng] 17     zoom(zoom: ZoomAmount, options?: Partial<ZoomOptions>, useTransition?: boolean);
[ng]        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng] Error: node_modules/chartjs-plugin-zoom/types/index.d.ts:25:17 - error TS7010: 'doPan', which lacks return-type annotation, implicitly has an 'any' return type.
[ng] 25 export function doPan(chart: Chart, pan: PanAmount, options?: Partial<PanOptions>, scales?: Scale[]);
[ng]                    ~~~~~
[ng] Error: node_modules/chartjs-plugin-zoom/types/index.d.ts:26:17 - error TS7010: 'doZoom', which lacks return-type annotation, implicitly has an 'any' return type.
[ng] 26 export function doZoom(chart: Chart, zoom: ZoomAmount, options?: Partial<ZoomOptions>, useTransition?: boolean);
[ng]                    ~~~~~~
[ng] Error: node_modules/chartjs-plugin-zoom/types/index.d.ts:27:17 - error TS7010: 'resetZoom', which lacks return-type annotation, implicitly has an 'any' return type.
[ng] 27 export function resetZoom(chart: Chart);

I tried editting the index.d.ts file eand added void return types to these methods and the errors were gone.

@kurkle
Copy link
Member

kurkle commented Apr 26, 2021

Sounds like correct fix, would you like to PR that?

@StefanNedelchev
Copy link
Author

StefanNedelchev commented Apr 27, 2021

@kurkle sorry for the late reply, I didn't expect such a quick reaction. Also I wasn't quite sure if void is the correct type for these methods so that's why I hesitated to make a PR. Thanks for fixing it! Also keep in mind that probably not everyone would have seen these errors because I have very strict typescript lint configuration which doesn't allow declaring properties and methods without explicit type but I think that most of the Angular devs who use strict mode would face this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants