Skip to content

TS2304: Cannot find name 'Sortable'. #186

Open

Description

@dgreuel

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"

Activity

  1. waynevanson commented on Sep 29, 2020

    @waynevanson
    Contributor

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

  2. wdoug commented on Oct 7, 2020

    @wdoug

    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?

  3. wdoug commented on Oct 7, 2020

    @wdoug

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

  4. dgreuel commented on Oct 7, 2020

    @dgreuel
    Author

    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. ❓

  5. wdoug commented on Oct 7, 2020

    @wdoug

    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

  6. kamster94 commented on Nov 19, 2020

    @kamster94

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

  7. added a commit that references this issue on Jan 7, 2021
  8. huangchen1031 commented on Nov 29, 2021

    @huangchen1031

    Use parcel@2.0.1 to build can resolve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions