Tsparticles: JSX element type 'Particles' does not have any construct or call signatures.

Created on 6 Nov 2020  路  3Comments  路  Source: matteobruni/tsparticles

Is the latest version affected?

  • [x] Yes
  • [ ] No

Which library are you using?

  • [ ] Vanilla JS (tsparticles)
  • [ ] React (react-tsparticles)
  • [ ] Vue.js 2.x (particles.vue)
  • [ ] Vue.js 3.x (particles.vue3)
  • [ ] Angular (ng-particles)
  • [ ] Svelte (svelte-particles)
  • [x] Preact (preact-particles)
  • [ ] Inferno (inferno-particles)
  • [ ] jQuery (jquery-particles)

Describe the bug
I am using the following packages with TypeScript version ^4.0.3:

"preact": "^10.5.3",
"preact-particles": "^1.18.10",
"typescript": "^4.0.3"

image

It doesn't seem to like the definition:

type Particles = PureComponent<IParticlesProps, IParticlesState>;
declare const Particles: Particles;

Usually, I would expect to see a class rather than a const but I'm no expert. For example, if I change it to:

export default class Particles extends React.PureComponent<
  IParticlesProps,
  IParticlesProps
> {};

then this works.

To Reproduce
Steps to reproduce the behavior:

  1. Use typescript": "^4.0.3 in your package.json and try to import and use Particles from preact-particles.

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Browser [e.g. chrome, safari]: I use Chrome but this error is from VS Code.
Preact good first issue help wanted up-for-grabs

All 3 comments

Thanks for opening a new issue. The team has been notified and will review it as soon as possible.

For urgent issues and priority support, visit https://xscode.com/matteobruni/tsparticles

Thanks for reporting that, I'm working on 1.18.11 for other fixes, I'll check out this too!

Anyway, that error should not break the component, I think.

@matteobruni Damn, that was quick! Thank you :) I hope that the suggested change I included is helpful, but I didn't want to add it as a pull request because I'm no expert with definition files. Much appreciated.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matteobruni picture matteobruni  路  3Comments

matteobruni picture matteobruni  路  4Comments

nikse picture nikse  路  4Comments

matteobruni picture matteobruni  路  6Comments

ecrookoh picture ecrookoh  路  3Comments