Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated Version Warning #23

Open
nickwild-999 opened this issue Apr 14, 2024 · 3 comments
Open

Deprecated Version Warning #23

nickwild-999 opened this issue Apr 14, 2024 · 3 comments

Comments

@nickwild-999
Copy link

When I install this I get a warning and the example code does not run. I have tried changing to @tspacticles/engine but it still is not working. This is the error from the demo code.

Looking into the repo it again I think it seems to be using a deprecated version of ts-particles with a different syntax

[{
	"resource": ".../test.astro",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": "2307",
	"severity": 8,
	"message": "Cannot find module 'tsparticles-engine' or its corresponding type declarations.",
	"source": "ts",
	"startLineNumber": 24,
	"startColumn": 60,
	"endLineNumber": 24,
	"endColumn": 80
},{
	"resource": ".../test.astro",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": "2307",
	"severity": 8,
	"message": "Cannot find module 'tsparticles' or its corresponding type declarations.",
	"source": "ts",
	"startLineNumber": 25,
	"startColumn": 28,
	"endLineNumber": 25,
	"endColumn": 41
},{
	"resource": "...test.astro",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": "2339",
	"severity": 8,
	"message": "Property 'particlesInit' does not exist on type 'Window & typeof globalThis'.",
	"source": "ts",
	"startLineNumber": 30,
	"startColumn": 10,
	"endLineNumber": 30,
	"endColumn": 23
},{
	"resource": "...test.astro",
	"owner": "_generated_diagnostic_collection_name_#1",
	"code": "2339",
	"severity": 8,
	"message": "Property 'particlesLoaded' does not exist on type 'Window & typeof globalThis'.",
	"source": "ts",
	"startLineNumber": 37,
	"startColumn": 10,
	"endLineNumber": 37,
	"endColumn": 25
}]
@ataverascrespo
Copy link

Was dealing with this as well. Seems like the astro component is not compatible with TSparticles 3.x yet, so make sure to add these two lines to your package.lock and package-lock.json:

"tsparticles": "2.12",
"tsparticles-engine": "^2.12.0"

then run an npm install, should fix your issue

@ataverascrespo
Copy link

Gonna quickly add onto this, since my last comment only fixes the type declaration issues with the module imports, but not the particlesLoaded and particlesInit errors.

To fix that, you'll need to create an index.d.ts file (if you haven't already). In that file, you'll just have to globally declare those properties for the window interface. Here's how I implemented it, for instance.

That should fix the issues with the properties and let you use the sample code from this repo!

@morandd
Copy link

morandd commented Aug 30, 2024

Eagerly looking forward to admins approving the v3 bump PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants