Open lwei-jlu opened 5 years ago
I think those typings are out of date
I think those typings are out of date
emm and i fond a new package react-sortablejs
and its error too
and i feel @types/stotablejs
is doesnt work
@lwei-jlu
The types do work and I keep them as up to date as possible.
For your specific case of imports, the named export is currently not there and the default is. You should the default in the meantime. I will address this in my next pull to @types/sortablejs.
Update sortablejs
and @types/sortablejs
to the latest and you'll get type definitions.
@lwei-jlu I've tried to get the current types working with this, but it seems I cannot get it to work as the namespace and the class share the same name. They're export from the index.d.ts
via assignment for module compatibility reasons (export = Sortable
instead of export default Sortable
).
What reason is there for not allowing allowSyntheticDefaultImports
to be set to true
?
I have the same problem.
FYI Typescript advises to use esModuleInterop
:
Note: The new behavior is added under a flag to avoid unwarranted breaks to existing code bases. We highly recommend applying it both to new and existing projects.
Although I can bring esModuleInterop
to my project without problems and will do so, I believe that not everyone could. Also wasted quite a lot of time digging around what do with it.
Mention in README along the lines of "Typescript users, your codebase must be compatible --esModuleInterop as you will must use it to use this library", and reference to Typescript docs that it is the right way forward.
@Akuukis This makes sense. Feel free to add a PR.
Problem:
hi,when i use sortablejs and @types/stotablejs in my app, i cannot use
import { Sortable } from 'sortablejs'
its cause to error, and cannot useimport * as Sortable from 'sortablejs'
, its cause to tip: sortable is not a construcor i think maybe is for default export, and i cannot want to useallowSyntheticDefaultImports : true
, so how can i export sortablejs?JSBin/JSFiddle demonstrating the problem:
Before you create an issue, check it:
Bindings: