Tsparticles: TypeScript error when importing into a React Project

Created on 23 Jun 2020  路  9Comments  路  Source: matteobruni/tsparticles

Has anyone experienced this before? I'm running Typescript 3.9 and getting "import type" errors

C:/Users/asiqueira/dev/Portfolio React/Projeto/web/node_modules/react-tsparticles/index.d.ts
TypeScript error in C:/Users/asiqueira/dev/Portfolio React/Projeto/web/node_modules/react-tsparticles/index.d.ts(9,13):
'=' expected.  TS1005

    7 | import { ComponentClass } from "react";
    8 | import { Container } from "tsparticles/dist/Core/Container";
 >  9 | import type { IOptions } from "tsparticles/dist/Options/Interfaces/IOptions";
      |             ^
   10 | import type { RecursivePartial } from "tsparticles/dist/Types/RecursivePartial";
   11 | import { IPolygonMaskOptions } from "tsparticles/dist/Plugins/PolygonMask/PolygonMaskPlugin";
   12 | import { IAbsorberOptions } from "tsparticles/dist/Plugins/Absorbers/AbsorbersPlugin";
bug

Most helpful comment

Matteo, thank you for your quick and helpful responses! It must've been a hookie mistake on my side. I'm not sure what fixed it, but it's now fixed.

If I find out what I was doing wrong I'll let you know for future evidence, but right now I don't know what I did.

All 9 comments

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.69. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Hi @alansiq, it's a strange issue but happened me one time that tsc was using the wrong version.

If you try tsc -v does it give you the right version?

Version 3.9.5

I'll try to install in another project just to make sure.

I've created a CodeSandbox with TS 3.9.5 and React so you can check your code too

https://codesandbox.io/s/peaceful-feistel-vig3y

Which version are you using btw?

Matteo, thank you for your quick and helpful responses! It must've been a hookie mistake on my side. I'm not sure what fixed it, but it's now fixed.

If I find out what I was doing wrong I'll let you know for future evidence, but right now I don't know what I did.

I have the same issue, on latest create-react-app (--template typescript, not typescript-particles).

Particles load and look to be working for a second before the error crashes the app. Any ideas?

I am seeing this issue too, upgrading typescript to 3.9.5 fixed it for me

I'm seeing this same error. I'm using tsc version 3.5.1 and latest react-tsparticles installed through yarn. Looks like it works in the sandbox so I'm confused why it's happening, any ideas?

Hi @atesija,

You need to update your TypeScript package to latest version

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeffgoh picture jeffgoh  路  4Comments

microraptor picture microraptor  路  3Comments

paul300497 picture paul300497  路  5Comments

Mayron picture Mayron  路  3Comments

matteobruni picture matteobruni  路  3Comments