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

TypeScript error using dragPlaceholder.createElement property #37

Open
wyze opened this issue Jun 2, 2020 · 3 comments
Open

TypeScript error using dragPlaceholder.createElement property #37

wyze opened this issue Jun 2, 2020 · 3 comments

Comments

@wyze
Copy link

wyze commented Jun 2, 2020

This library is great and loving it so far!

I am receiving the following error when using the dragPlaceholder.createElement property:

Property 'getElement' does not exist on type 'DecoratedItem'.

It is included and exported from the muuri.d.ts file but that is not included in the dist/ directory.

https://github.com/Paol-imi/muuri-react/blob/f31c84771cf9fa2d66c12cf5b0dde6d6e090b400/src/muuri.d.ts#L341

Here is the code I am using according to the docs:

<MuuriComponent
  dragPlaceholder={{
    enabled: true,
    createElement: (item) => {
      return item.getElement()?.cloneNode(true)
    },
  }}
/>

I also through together a CodeSandbox where you can see the error here: https://codesandbox.io/s/sad-sid-ovx9s?file=/src/App.tsx:1117-1185

@bo-ora
Copy link

bo-ora commented Nov 24, 2020

Confirm that issue exists in version 3.1.6 of muuri-react.

Also, there is another issue with typings for DecoratedGrid as well, it is missing the next methods:

  • getElement
  • refreshItems

@stan-lit
Copy link

Seems that an issue just in wrong imports from muuri:

image

@paol-imi
Copy link
Owner

Sorry for the inconvenience.

When this version was written muuri had no type declaration so I created them in a .d.ts file which was not included in the bundle by mistake. (This is why you see the local import "import type { } from ../muuri").

In this period I have very little free time but I will try to solve it as soon as possible.

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

4 participants