Skip to content

use `window.setInterval()` instead of `setInterval()`

Kerstin Humm requested to merge erictapen/mobilizon:set-interval into main

When building Mobilizon for Nixpkgs, I stumbled on this build error:

mobilizon>  ERROR  Failed to compile with 1 error          12:57:08 PM
mobilizon>  error  in src/App.vue:159:5
mobilizon> TS2322: Type 'Timer' is not assignable to type 'number'.
mobilizon>     157 |     });
mobilizon>     158 |
mobilizon>   > 159 |     this.interval = setInterval(async () => {
mobilizon>         |     ^^^^^^^^^^^^^
mobilizon>     160 |       const accessToken = localStorage.getItem(AUTH_ACCESS_TOKEN);
mobilizon>     161 |       if (accessToken) {
mobilizon>     162 |         const token = jwt_decode<JwtPayload>(accessToken);

The proposed patch fixed the error, but I'm not sure wether it's the right solution here. Apparently setInterval returns not a number?

Merge request reports