0

I'm trying to use the party-js lib in order to get the confetti effect working in a angular project. However when using following code i get an error saying that this has type any. I tried using ':' and adding a type after but then i don't know what type I have to put after since it doesn't change the error and also gives me another one saying, that I now have 3 instead of 2 arguments.

document.querySelector(".button")!.addEventListener("click", function (e) { 
party.confetti(this:);
});
Nova
  • 50
  • 8
  • 1
    `this: HTMLElement party, { count: party.variation.range(20, 40), }` doesn't look like valid syntax. What does this mean? – jabaa May 05 '22 at 11:15
  • Had the wrong thing in my clipboard since i tried out a few things to fix it. I changed it back to the original Code snipped i found on https://party.js.org/docs. (Added the '!' since there was an Error saying the return of the querySelector might be null. – Nova May 05 '22 at 11:30
  • `party.confetti(this:);` doesn't look like valid syntax, too. Do you have question that isn't answered in the duplicate? – jabaa May 05 '22 at 12:08
  • They this: type doesn't work for me, however i found another answer that stated to change some stuff in the tsconfig.json ´´´// disable this rule: // "strict": true, // enable this rule: "noImplicitAny": false´´´ If i do that, the error disappears obviously but then the full content of the site is missing. The Syntax should be valid since it's copied from their website. – Nova May 06 '22 at 07:12
  • You disabled the type check. Why do you use TypeScript if you disable the checks? Without checks, you could also use JavaScript. – jabaa May 06 '22 at 07:35

0 Answers0