question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Re-export the ReferenceObject type of popper.js with the Popper component

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

Should be able to import the ReferenceObject interface from material-ui instead of popper.js.

Examples 🌈

Current way:

import { ReferenceObject } from 'popper.js'
import { Popper } from '@material-ui/core'

export default function ExamplePopperWrapper({
  anchorEl
}: {
  anchorEl: ReferenceObject
}) {
  return <Popper anchorEl={anchorEl} />
}

Proposed way:

import { Popper, PopperReferenceObject } from '@material-ui/core'

export default function ExamplePopperWrapper({
  anchorEl
}: {
  anchorEl: PopperReferenceObject
}) {
  return <Popper anchorEl={anchorEl} />
}

I don’t know where it should be exported from, but somewhere in the material-ui core package. Otherwise, the abstraction is broken.

Motivation 🔦

Typing my code properly without breaking abstraction or adding dependencies that are not directly used.

Thanks 😃

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
eps1loncommented, May 25, 2020

Something like

import Popper, { PopperProps } from '@material-ui/core/Popper'

export default function ExamplePopperWrapper({
  anchorEl
}: {
  anchorEl: NonNullable<PopperProps['anchorEl']>
}) {
  return <Popper anchorEl={anchorEl} />
}
1reaction
oliviertassinaricommented, May 27, 2020

@eps1lon’s approach sounds perfect, @DaniGuardiola let us know if you face any limitations with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re-export the ReferenceObject type of popper.js with ... - GitHub
I don't know where it should be exported from, but somewhere in the material-ui core package. Otherwise, the abstraction is broken. Motivation ...
Read more >
Popper (v1.×)
The dataObject is an object containing all the information used by Popper.js. This object is passed to modifiers and to the onCreate and...
Read more >
Migration Guide | Popper
In Popper 1, it was a class: import Popper from 'popper.js'; new Popper(reference, popper, options);. In Popper 2, it's now a function:.
Read more >
How to fix this errors when instaling @popperjs/core
In ./.angular.json at the row scripts : "../node_modules/popper.js/dist/esm/popper.js". or: "../node_modules/popper.js/dist/umd/popper.js".
Read more >
React Popper component - Material UI - MUI
A Popper can be used to display some content on top of another. It's an alternative to react-popper.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found