The typescript type declaration does not match the structure of the actual module
Closed this issue · 0 comments
lovasoa commented
In the typescript declaration, BitSet
is declared as a class inside the module :
https://github.com/infusion/BitSet.js/blob/master/bitset.d.ts#L202
Which would mean it would have to be used this way :
import { BitSet } from "bitset";
However, in the code itself, BitSet
is declared as the module itself :
https://github.com/infusion/BitSet.js/blob/master/bitset.js#L1002
import BitSet from "bitset";
So, the result is that :
import { BitSet } from "bitset"
results in a runtime error (SyntaxError: The requested module 'bitset' does not provide an export named 'BitSet'
) andimport BitSet from "bitset"
results in a type error atnew BitSet
(This expression is not constructable. Type 'typeof import(".../node_modules/bitset/bitset")' has no construct signatures.
).