From 2da98a6024ffc298b731a34c00af428705e42575 Mon Sep 17 00:00:00 2001 From: Germain Date: Wed, 8 Feb 2023 12:12:14 +0000 Subject: [PATCH] Make TS strict the effects folder (#10111) --- src/effects/confetti/index.ts | 3 ++- src/effects/fireworks/index.ts | 5 +++-- src/effects/hearts/index.ts | 6 +++--- src/effects/rainfall/index.ts | 6 +++--- src/effects/snowfall/index.ts | 6 +++--- src/effects/spaceinvaders/index.ts | 6 +++--- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/effects/confetti/index.ts b/src/effects/confetti/index.ts index 9900236a21..32b6073845 100644 --- a/src/effects/confetti/index.ts +++ b/src/effects/confetti/index.ts @@ -1,6 +1,7 @@ /* Copyright 2020 Nurjin Jafar Copyright 2020 Nordeck IT + Consulting GmbH. + Copyright 2023 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -86,7 +87,7 @@ export default class Confetti implements ICanvasEffect { private particles: Array = []; private waveAngle = 0; - public isRunning: boolean; + public isRunning = false; public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise => { if (!canvas) { diff --git a/src/effects/fireworks/index.ts b/src/effects/fireworks/index.ts index f37b7152f0..40a8e7593e 100644 --- a/src/effects/fireworks/index.ts +++ b/src/effects/fireworks/index.ts @@ -1,6 +1,7 @@ /* Copyright 2020 Nurjin Jafar Copyright 2020 Nordeck IT + Consulting GmbH. + Copyright 2023 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -69,7 +70,7 @@ export default class Fireworks implements ICanvasEffect { private context: CanvasRenderingContext2D | null = null; private supportsAnimationFrame = window.requestAnimationFrame; private particles: Array = []; - public isRunning: boolean; + public isRunning = false; public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise => { if (!canvas) { @@ -94,7 +95,7 @@ export default class Fireworks implements ICanvasEffect { if (this.particles.length < this.options.maxCount && this.isRunning) { this.createFirework(); } - const alive = []; + const alive: FireworksParticle[] = []; for (let i = 0; i < this.particles.length; i++) { if (this.move(this.particles[i])) { alive.push(this.particles[i]); diff --git a/src/effects/hearts/index.ts b/src/effects/hearts/index.ts index af4dca154f..3c082e3589 100644 --- a/src/effects/hearts/index.ts +++ b/src/effects/hearts/index.ts @@ -1,5 +1,5 @@ /* - Copyright 2021 The Matrix.org Foundation C.I.C. + Copyright 2021 - 2023 The Matrix.org Foundation C.I.C. Copyright 2022 Arseny Uskov Licensed under the Apache License, Version 2.0 (the "License"); @@ -65,7 +65,7 @@ export default class Hearts implements ICanvasEffect { private context: CanvasRenderingContext2D | null = null; private particles: Array = []; - private lastAnimationTime: number; + private lastAnimationTime = 0; private colours = [ "rgba(194,210,224,1)", @@ -82,7 +82,7 @@ export default class Hearts implements ICanvasEffect { "rgba(252,116,183,1)", ]; - public isRunning: boolean; + public isRunning = false; public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise => { if (!canvas) { diff --git a/src/effects/rainfall/index.ts b/src/effects/rainfall/index.ts index c0b4d71c77..8b91ab19b9 100644 --- a/src/effects/rainfall/index.ts +++ b/src/effects/rainfall/index.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 The Matrix.org Foundation C.I.C. + Copyright 2020 - 2023 The Matrix.org Foundation C.I.C. Copyright 2021 Josias Allestad Licensed under the Apache License, Version 2.0 (the "License"); @@ -52,9 +52,9 @@ export default class Rainfall implements ICanvasEffect { private context: CanvasRenderingContext2D | null = null; private particles: Array = []; - private lastAnimationTime: number; + private lastAnimationTime = 0; - public isRunning: boolean; + public isRunning = false; public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise => { if (!canvas) { diff --git a/src/effects/snowfall/index.ts b/src/effects/snowfall/index.ts index 9604f79647..8c51e8e22a 100644 --- a/src/effects/snowfall/index.ts +++ b/src/effects/snowfall/index.ts @@ -1,5 +1,5 @@ /* - Copyright 2020 The Matrix.org Foundation C.I.C. + Copyright 2020 - 2023 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -57,9 +57,9 @@ export default class Snowfall implements ICanvasEffect { private context: CanvasRenderingContext2D | null = null; private particles: Array = []; - private lastAnimationTime: number; + private lastAnimationTime = 0; - public isRunning: boolean; + public isRunning = false; public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise => { if (!canvas) { diff --git a/src/effects/spaceinvaders/index.ts b/src/effects/spaceinvaders/index.ts index 6d148ce16d..f375aee88b 100644 --- a/src/effects/spaceinvaders/index.ts +++ b/src/effects/spaceinvaders/index.ts @@ -1,5 +1,5 @@ /* - Copyright 2021 The Matrix.org Foundation C.I.C. + Copyright 2021 - 2023 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -51,9 +51,9 @@ export default class SpaceInvaders implements ICanvasEffect { private context: CanvasRenderingContext2D | null = null; private particles: Array = []; - private lastAnimationTime: number; + private lastAnimationTime = 0; - public isRunning: boolean; + public isRunning = false; public start = async (canvas: HTMLCanvasElement, timeout = 3000): Promise => { if (!canvas) {