Skip to content

Commit

Permalink
Remove HACKHACK (#2790)
Browse files Browse the repository at this point in the history
BP requires `"@types/react": "^16.0.34"` and it is pinned by `yarn.lock`.

For this version of typings, it is provided an overload, then the `HACKHACK` does not persist.

```ts
    function createElement<P>(
        type: SFC<P> | ComponentClass<P> | string,
        props?: Attributes & P,
        ...children: ReactNode[]): ReactElement<P>;
```

See issue: #2785
  • Loading branch information
artola authored and giladgray committed Aug 10, 2018
1 parent d9a42fb commit c515b37
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/core/src/components/collapse/collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,8 @@ export class Collapse extends AbstractPureComponent<ICollapseProps, ICollapseSta
transition: isAutoHeight ? "none" : undefined,
};

// HACKHACK: type cast because there's no single overload that supports all
// three ReactTypes (string | ComponentClass | StatelessComponent)
return React.createElement(
this.props.component as any,
this.props.component,
{
className: classNames(Classes.COLLAPSE, this.props.className),
style: containerStyle,
Expand Down

1 comment on commit c515b37

@blueprint-bot
Copy link

Choose a reason for hiding this comment

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

Remove `HACKHACK` (#2790)

Preview: documentation | landing | table

Please sign in to comment.