I installed a package called "js-linq" (https://github.com/battousai999/js-linq) via npm install js-linq
and it appeared to install correctly. This is explicitly in the documentation on npm (https://www.npmjs.com/package/js-linq).
I import it with the usual syntax import { Linq } from 'js-linq'
and then try to use it in my React project according to the documentation: const items = Linq.from([1, 2, 3, 4, 5])
.
There are no typescript errors or anything suggesting the import is bad.
But at runtime it fails, saying Linq is undefined
.
What am I doing wrong here?
2
Answers
It seems like the types in this package in
jslinq.ts
don’t match up with what’s actually exported in the Javascriptjslinq.js
. You can get it to work as follows:Please use yarn