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

not sure how to use with typescript #27

Open
MathieuDerelle opened this issue Mar 15, 2022 · 0 comments
Open

not sure how to use with typescript #27

MathieuDerelle opened this issue Mar 15, 2022 · 0 comments

Comments

@MathieuDerelle
Copy link

MathieuDerelle commented Mar 15, 2022

I've seen you have a index.d.ts which, to me, means that your library supports types for TS.

when using

import WZoom from 'vanilla-js-wheel-zoom'
const wzoom = WZoom.create(img, { maxScale: 10, speed: 5 })

the inferred type of wzoom is any

and when using

import WZoom from 'vanilla-js-wheel-zoom'
const wzoom: WZoom = WZoom.create(img, { maxScale: 10, speed: 5 })

I get the error : Cannot use namespace 'WZoom' as a type

with

import WZoom from 'vanilla-js-wheel-zoom'
const wzoom: InstanceType<typeof WZoom> = WZoom.create(img, { maxScale: 10, speed: 5 })

the inferred type of wzoom is still any

I am not sure what is the proper way to do this

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

No branches or pull requests

1 participant