nathancahill / split

Unopinionated utilities for resizeable split views
https://split.js.org/
MIT License
6.15k stars 450 forks source link

react-split 2.0.13 Typescript "extends" incompatible #693

Closed baumerdev closed 2 years ago

baumerdev commented 3 years ago

In react-split's SplitProps interface you removed className?: string in favour of extending from React.HTMLAttributes<HTMLDivElement>.

(see https://github.com/nathancahill/split/issues/689 and https://github.com/nathancahill/split/commit/e18c3a07dc607725c708b2c476dff52f9b515142)

The problem is, that some types in SplitProps have the same names as in @types/react's React.HTMLAttributes<HTMLDivElement> but different definitions, like onDrag

SplitProps: onDrag?: Options["onDrag"] DOMAttributes (which HTMLAttributes extends from): onDrag?: DragEventHandler<T> | undefined;

And that can generate errors like this:

Interface 'SplitProps' incorrectly extends interface 'HTMLAttributes<HTMLDivElement>'.
  Types of property 'onDrag' are incompatible.
    Type '((sizes: number[]) => void) | undefined' is not assignable to type 'DragEventHandler<HTMLDivElement> | undefined'.
      Type '(sizes: number[]) => void' is not assignable to type 'DragEventHandler<HTMLDivElement>'.
        Types of parameters 'sizes' and 'event' are incompatible.
          Type 'DragEvent<HTMLDivElement>' is missing the following properties from type 'number[]': length, pop, push, concat, and 28 more.

export interface SplitProps extends React.HTMLAttributes<HTMLDivElement> {
nathancahill commented 3 years ago

Right you are. We'll have to Omit<> and then extend.

LakshmiChaitanya2008 commented 3 years ago

same issue

LakshmiChaitanya2008 commented 3 years ago

now how can i solve this?

LakshmiChaitanya2008 commented 3 years ago

bro fix this issue please!

catdad commented 2 years ago

I second the need to fix this. It looks like there is already an open PR for this. Is there anything else we can help with in order to have this fixed?

nathancahill commented 2 years ago

Hi guys, sorry for the delay, have a newborn at home. I'd love help maintaining this library if anyone is interested. We already have 4 maintainers with push access, but I'd love to add more. @catdad if you're interested?

brandonptucker commented 2 years ago

@nathancahill Looks like @baumerdev's PR was merged into master. Can we get react-split published to npm?

RKim220 commented 2 years ago

@nathancahill Anything needed to get this published? Thanks!

nathancahill commented 2 years ago

Sorry yes, just published as v2.0.14.