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

fix: declare children prop explicitly for class components #5266

Merged
merged 3 commits into from
Apr 21, 2022

Conversation

adidahiya
Copy link
Contributor

Fixes #5250

Follow-up to #5258

Changes proposed in this pull request:

Audit all remaining usage of props.children. Where components do use children, we now declare that prop type explicitly for compatibility with @types/react@18.

@blueprint-bot
Copy link

fix: declare children prop explicitly for class components

Previews: documentation | landing | table | demo

@@ -26,6 +26,9 @@ import { RadioProps, Radio } from "./controls";
export type RadioGroupProps = IRadioGroupProps;
/** @deprecated use RadioGroupProps */
export interface IRadioGroupProps extends Props {
/** Drawer contents. */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/** Drawer contents. */

@@ -45,6 +45,8 @@ export interface IPopoverProps extends IPopoverSharedProps {
/** HTML props for the backdrop element. Can be combined with `backdropClassName`. */
backdropProps?: React.HTMLProps<HTMLDivElement>;

children?: React.ReactNode;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably go into IPopoverSharedProps

@blueprint-bot
Copy link

address self-review

Previews: documentation | landing | table | demo

@blueprint-bot
Copy link

fix test type errors

Previews: documentation | landing | table | demo

@andreash
Copy link

andreash commented Oct 24, 2022

I am using @types/react 18.0.21 and @blueprintjs/table 4.7.4. I am still getting a type-script error in vscode for Column components:

'Column' cannot be used as a JSX component.
  Its instance type 'Column' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'ReactNode' is not assignable to type 'false | Element'.
        Type 'string' is not assignable to type 'false | Element'.ts(2786)

Any idea?

Code example:

ReactDOM.render(
    <HotkeysProvider>
        <Table2 numRows={5}>
            <Column />
            <Column />
            <Column />
        </Table2>
    </HotkeysProvider>,
    document.querySelector("#app"),
);

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

Successfully merging this pull request may close these issues.

Getting type errors after upgrading to @types/react v18.0.0.
3 participants