vanilla-js-wheel-zoom icon indicating copy to clipboard operation
vanilla-js-wheel-zoom copied to clipboard

not sure how to use with typescript

Open MathieuDerelle opened this issue 4 years ago • 0 comments

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

MathieuDerelle avatar Mar 15 '22 09:03 MathieuDerelle

Hi. If possible, please send me a PR. Unfortunately, I am unable to answer your question right now.

worka avatar Mar 21 '22 00:03 worka