Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS2304: Cannot find name 'Sortable'. #186

Open
dgreuel opened this issue Sep 28, 2020 · 7 comments
Open

TS2304: Cannot find name 'Sortable'. #186

dgreuel opened this issue Sep 28, 2020 · 7 comments

Comments

@dgreuel
Copy link

dgreuel commented Sep 28, 2020

Getting these errors when trying to build my project

node_modules/react-sortablejs/dist/index.d.ts:27:40 - error TS2304: Cannot find name 'Sortable'.

27     setList: (newState: T[], sortable: Sortable | null, store: Store) => void;
                                          ~~~~~~~~

node_modules/react-sortablejs/dist/index.d.ts:61:104 - error TS2304: Cannot find name 'Sortable'.

61 export type ReactSortableOptions = Partial<Record<AllMethodsExceptMove, (evt: SortableEvent, sortable: Sortable | null, store: Store) => void>> & {
                                                                                                          ~~~~~~~~

node_modules/react-sortablejs/dist/index.d.ts:69:63 - error TS2304: Cannot find name 'Sortable'.

69     onMove?: (evt: MoveEvent, originalEvent: Event, sortable: Sortable | null, store: Store) => boolean | -1 | 1 | void;

yarn.lock has these versions:

"@types/sortablejs@^1.10.6":
  version "1.10.6"
react-sortablejs@^6.0.0:
  version "6.0.0"
sortablejs@^1.10.6:
  version "1.12.0"
@waynevanson
Copy link
Collaborator

Does setting skipLibCheck: false or other skip* settings fix this?

@wdoug
Copy link

wdoug commented Oct 7, 2020

Using skipLibCheck does allow it to run, but so does adding Sortable to the import in dist/index.d.ts, which is already importing other things from sortablejs.

- import { MoveEvent, Options, SortableEvent } from "sortablejs";
+ import Sortable, { MoveEvent, Options, SortableEvent } from "sortablejs";

This seems preferable. How does that file get built?

@wdoug
Copy link

wdoug commented Oct 7, 2020

At first glance, it looks like it should already be included here. ❓

@dgreuel
Copy link
Author

dgreuel commented Oct 7, 2020

That's what I found as well...not sure why that import doesn't end up in the compiled definitions file.

At first glance, it looks like it should already be included here. ❓

@wdoug
Copy link

wdoug commented Oct 7, 2020

I wonder if this is the same underlying issue from Parcel: parcel-bundler/parcel#4250

What was the reason for switching to Parcel for building this library? At least the Parcel-2 beta doesn't quite seem ready

@kamster94
Copy link

Is that issue going to be resolved? It prevents me from publishing app, and I don't want to use skips

MonkeyDo added a commit to metabrainz/listenbrainz-server that referenced this issue Dec 11, 2020
Issue with SortableJS types rather than our code.
See SortableJS/react-sortablejs#186 andemove skipLibCheck once the issue is fixed.
MonkeyDo added a commit to metabrainz/listenbrainz-server that referenced this issue Dec 11, 2020
* Add ForkTsChecker webpack plugin

Runs type checking in a separate thread. Previously webpack (with babel-loader) was completely ignoring typescript types.

* Remove type_checker container

Now that webpack does type-checking, it is superfluous.

* Update package-lock.json

* Fix some typescript errors in code

* Skip type checking of library definitions

Issue with SortableJS types rather than our code.
See SortableJS/react-sortablejs#186 andemove skipLibCheck once the issue is fixed.

* Ignore local node_modules folder in docker context
Aysnine added a commit to Aysnine/rc-dynamic that referenced this issue Jan 7, 2021
@huangchen1031
Copy link

Use [email protected] to build can resolve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants