docs icon indicating copy to clipboard operation
docs copied to clipboard

Data typing

Open Scimonster opened this issue 1 year ago • 2 comments

Hi, I'm using dnd-kit in a TypeScript project, and would like to strongly type the data property attached to Draggable objects.

I tried extending the interface, the way other libraries sometimes implement it, but it didn't work.

declare module '@dnd-kit/core/dist/store/types' {
    export interface Active {
        data: DataRef<MyDataType>;
    }
}

TypeScript gives an error Subsequent property declarations must have the same type. Property 'data' must be of type 'DataRef<AnyData>', but here has type 'DataRef<MyDataType>'.

It would be great if a future version could expose an API for either extending the interface, or at passing generics to the DnDContext component.

Scimonster avatar Apr 07 '24 14:04 Scimonster

Why is no one talking about this???

quantrung avatar Dec 05 '24 13:12 quantrung

Hi @Scimonster sorry to hijack this thread. Can you comment on this Utif.js discussion regarding granting publish rights on the utif-js non-official package to the original author of the library, @photopea or other interested developers?

In the meantime, @jardicc published utifjs2, which is the state of the package 2 years back while yours is 6 years old. It will soon have more momentum than yours (770k weekly dls vs 870k), clearly it would be great to have the utifjs npm package be somehow officially maintained.

jo-chemla avatar Jul 18 '25 08:07 jo-chemla