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.

Update TS typings for Popper

See original GitHub issue

I’ve just update MUI next to beta 37 and with it popper at v1.14 (previously it was v1.12). But not the TS compiler would complain about wrong typings:

node_modules/react-popper/react-popper.d.ts(38,17): error TS2503: Cannot find namespace 'PopperJS'.

I guess instead of:

import PopperJS from "popper.js";
const v: PopperJS.Placement;

we should use:

import {Placement} from "popper.js";
const v: Placement;

or

import * as PopperJS from "popper.js";
const v: PopperJS.Placement;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

21reactions
FezVrastacommented, Mar 12, 2018

Oh fuck, I hate TypeScript, it’s so fucking cryptic… Would it be a solution if a dropped support for it from Popper.js completely? I can’t stand it anymore 😩

Bloody me and the day I decided to merge the TS support PR…

4reactions
rolandjitsucommented, Mar 12, 2018

😆 @FezVrasta I don’t think you need to. Changing the way this lib declares the import should suffice. There is already a PR here that addresses the typings, it just needs to be changed slightly.

I’ve just testd with import * as PopperJS from "popper.js"; instead of import PopperJS from "popper.js"; and it seems to work.

Ideally you’d always import the necessary exported objects from the lib instead of everything:

// e.g.
import {Placement, Modifiers} from 'popper.js';
Read more comments on GitHub >

github_iconTop Results From Across the Web

Update TS typings for Popper · Issue #101 - GitHub
I've just update MUI next to beta 37 and with it popper at v1.14 (previously it was v1.12 ). But not the TS...
Read more >
Typings | Popper
Typings. Popper comes with type definitions for both Flow and TypeScript. The project is type checked by Flow, and type definitions for TypeScript...
Read more >
Bootstrap 4 TypeScript Type Definition fails to compile
It appears my Bootstrap type definition file fails compilation as it cannot find the popper. js module.
Read more >
@popperjs/core - npm
Popper solves all of these key problems in an elegant, performant manner. It is a lightweight ~3 kB library that aims to provide...
Read more >
Usage of Angular libraries published to npm
Typically, library packages include typings in .d.ts files; see examples in ... To check for updates to your installed libraries, use the ng...
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