patternfly-react icon indicating copy to clipboard operation
patternfly-react copied to clipboard

`react-core` type declarations contain bugs

Open allisonkarlitskaya opened this issue 1 year ago • 4 comments

Quite simple: when we run tsc on our project we get a bunch of error output from the PatternFly type declarations:

node_modules/@patternfly/react-core/dist/esm/components/MenuToggle/MenuToggleCheckbox.d.ts:4:18 - error TS2430: Interface 'MenuToggleCheckboxProps' incorrectly extends interface 'Omit<HTMLProps<HTMLInputElement>, "disabled" | "type" | "onChange" | "checked">'.
  Types of property 'defaultChecked' are incompatible.
    Type 'boolean | null' is not assignable to type 'boolean | undefined'.
      Type 'null' is not assignable to type 'boolean | undefined'.

4 export interface MenuToggleCheckboxProps extends Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'onChange' | 'disabled' | 'checked'>, OUIAProps {
                   ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@patternfly/react-core/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts:4:35 - error TS2304: Cannot find name 'SVGIconProps'.

4     success: React.ComponentClass<SVGIconProps, any>;
                                    ~~~~~~~~~~~~

node_modules/@patternfly/react-core/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts:5:34 - error TS2304: Cannot find name 'SVGIconProps'.

5     danger: React.ComponentClass<SVGIconProps, any>;
                                   ~~~~~~~~~~~~

node_modules/@patternfly/react-core/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts:6:35 - error TS2304: Cannot find name 'SVGIconProps'.

6     warning: React.ComponentClass<SVGIconProps, any>;
                                    ~~~~~~~~~~~~

node_modules/@patternfly/react-core/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts:7:32 - error TS2304: Cannot find name 'SVGIconProps'.

7     info: React.ComponentClass<SVGIconProps, any>;
                                 ~~~~~~~~~~~~

node_modules/@patternfly/react-core/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts:8:34 - error TS2304: Cannot find name 'SVGIconProps'.

8     custom: React.ComponentClass<SVGIconProps, any>;
                                   ~~~~~~~~~~~~

node_modules/@patternfly/react-core/dist/esm/helpers/Popper/thirdparty/popper-core/types.d.ts:118:34 - error TS2344: Type 'Options' does not satisfy the constraint 'Obj'.

118     fn: (arg0: ModifierArguments<Options>) => State | void;
                                     ~~~~~~~

  node_modules/@patternfly/react-core/dist/esm/helpers/Popper/thirdparty/popper-core/types.d.ts:112:33
    112 export interface Modifier<Name, Options> {
                                        ~~~~~~~
    This type parameter might need an `extends Obj` constraint.

node_modules/@patternfly/react-core/dist/esm/helpers/Popper/thirdparty/popper-core/types.d.ts:119:39 - error TS2344: Type 'Options' does not satisfy the constraint 'Obj'.

119     effect?: (arg0: ModifierArguments<Options>) => () => void | void;
                                          ~~~~~~~

  node_modules/@patternfly/react-core/dist/esm/helpers/Popper/thirdparty/popper-core/types.d.ts:112:33
    112 export interface Modifier<Name, Options> {
                                        ~~~~~~~
    This type parameter might need an `extends Obj` constraint.


Found 8 errors in 3 files.

Errors  Files
     1  node_modules/@patternfly/react-core/dist/esm/components/MenuToggle/MenuToggleCheckbox.d.ts:4
     5  node_modules/@patternfly/react-core/dist/esm/components/NotificationDrawer/NotificationDrawerListItemHeader.d.ts:4
     2  node_modules/@patternfly/react-core/dist/esm/helpers/Popper/thirdparty/popper-core/types.d.ts:118

We can't use skipLibCheck because we have .d.ts files in our own project that we want to check.

We're using "@patternfly/react-core": "5.3.3".

allisonkarlitskaya avatar Jul 03 '24 14:07 allisonkarlitskaya

Do you have strict mode enabled?

tlabaj avatar Aug 08 '24 15:08 tlabaj

Yes.

allisonkarlitskaya avatar Aug 08 '24 22:08 allisonkarlitskaya

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] avatar Oct 08 '24 11:10 github-actions[bot]

Needless to say, this isn't fixed yet, except now it's increased to 10 errors in 4 files...

allisonkarlitskaya avatar Oct 08 '24 12:10 allisonkarlitskaya