I have imported desired module:
import ionRangeSlider from 'ion-rangeslider'
Then I used it:
jQuery('#price_range').ionRangeSlider({
...
})
But there's this error on import line:
'ionRangeSlider' is declared but its value is never read.ts(6133)
Why does this error appear? I have just used my imported module.
If you can't drop the import
, then you could disable the warning.
Please note that the error could arise from the typescript compiler or TSLint (if you're using TSLint). Both have almost the same warning.
In this case I think it's from the typescript compiler because of the error number. (6133)
If this is a typescript error then add before the import // @ts-ignore
, e.g.
// @ts-ignore
import ionRangeSlider from 'ion-rangeslider
Note this will disable all warning for the import line. This needs typescript 2.6+
See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html
If you're using TSLint, which could give the same error, you could disable it as follows.
Add a tslint comment to disable the warning. For example:
// tslint:disable-next-line:no-unused-variable
import ionRangeSlider from 'ion-rangeslider
If you need this for multiple lines, you could drop the "next line", e.g.
// tslint:disable:no-unused-variable
Recommended then to enable it later in the file:
// tslint:enable:no-unused-variable
See https://palantir.github.io/tslint/usage/rule-flags/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With