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.

[Bug]: Custom typings of built-in libs are in conflict with the libs from TypeScript 4.4

See original GitHub issue

Contact Details

j.vanoostveen@afas.nl

What happened?

When installing tsparticles in combination with TS4.4+, the lib.dom.d.ts reports an error because of a collision with typings of Document within this library.

node_modules/typescript/lib/lib.dom.d.ts:4256:11 - error TS2430: Interface 'Document' incorrectly extends interface 'FontFaceSource'.
  Types of property 'fonts' are incompatible.
    Type 'FontFaceSet' is missing the following properties from type 'FontFaceSet': onloading, onloadingdone, onloadingerror, forEach, and 13 more.

4256 interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShadowRoot, FontFaceSource, GlobalEventHandlers, NonElementParentNode, ParentNode, XPathEvaluatorBase {

I don’t understand why there are global definition of the DOM in this library, but it would be preferred they are at least compatible with the built-in definitions provided by TypeScript self.

A minimal repro case can be found here: https://github.com/jvanoostveen/tsparticles-ts4.4

Version

1.19.1

Which library are you using?

Vanilla (tsparticles)

tsParticles Configuration

(any configuration will do...)

confetti(`confettiWrapper`, {
  angle: 90,
  count: 5,
  position: { x: 100, y: 100 },
  spread: 100,
  startVelocity: 75,
  decay: 0.8,
  gravity: 2,
  drift: 0,
  ticks: 75,
  colors: ['#ff0000', '#ff8400', '#ffea00', '#00ff00', '#00bbff', '#0000ff', '#ff00ff'],
  shapes: ['circle'],
  scalar: 1.25,
  zIndex: 2000,
  disableForReducedMotion: true
});

What browsers are you seeing the problem on?

No response

Relevant log output

node_modules/typescript/lib/lib.dom.d.ts:4256:11 - error TS2430: Interface 'Document' incorrectly extends interface 'FontFaceSource'.
  Types of property 'fonts' are incompatible.
    Type 'FontFaceSet' is missing the following properties from type 'FontFaceSet': onloading, onloadingdone, onloadingerror, forEach, and 13 more.

4256 interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShadowRoot, FontFaceSource, GlobalEventHandlers, NonElementParentNode, ParentNode, XPathEvaluatorBase {

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
matteobrunicommented, Sep 17, 2021

I think it could be released in some days, I need to add the auto theme switch feature and it will be ready

0reactions
matteobrunicommented, Sep 19, 2021

1.35.0 has been released, closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript module versions conflicts · Issue #33137 - GitHub
I've still having problems with TypeScript and types resolution, not only with monorepositories: As i said, npm allows to install more than one ......
Read more >
Documentation - TypeScript 4.5
TypeScript 4.5 introduces a way to override a specific built-in lib in a manner similar to how @types/ support works. When deciding which...
Read more >
TypeScript 2: custom typings for untyped npm module
If you have custom typings or single loose d.ts files that are not contained withing a folder following ... index.d.ts has declare module...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
{24,25} conflicting types for 'poll_initwait'" status:RESOLVED ... Bug:270098 - "sys-freebsd/freebsd-lib-7.1: miscompilation with gcc 4.4 without ...
Read more >
Common TypeScript module problems and how to solve them
Enabling the compiler module resolution tracing in TypeScript can provide insight in diagnosing and solving problems.
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