Skip to content

Commit

Permalink
chore(shared): Make Timer.once always return a boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
xLuxy committed Sep 21, 2024
1 parent ec85d9b commit 6ebfa08
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions shared/js/timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Timer {
lastTick;
/** @type {boolean} */
once;

/** @type {{ fileName: string, lineNumber: number }} */
location;

Expand Down Expand Up @@ -81,6 +82,7 @@ class Timer {
assertIsType(type, "number", "Expected a number as first argument");
assertIsType(callback, "function", "Expected a function as second argument");
assertIsType(interval, "number", "Expected a number as third argument");
assertIsType(once, "boolean", "Expected a boolean as fourth argument");

this.interval = interval;
this.callback = callback.bind(this, ...(Array.isArray(args) ? args : []));
Expand Down
2 changes: 1 addition & 1 deletion types/shared/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3468,7 +3468,7 @@ declare abstract class Timer {
public interval: number;
public callback: Function;
public lastTick: number;
public once?: boolean;
public once: boolean;
public location: import("@altv/shared").SourceLocation;

public get type(): import("@altv/shared").Enums.TimerType;
Expand Down
2 changes: 1 addition & 1 deletion types/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/shared",
"version": "0.0.23",
"version": "0.0.24",
"description": "This package contains the type definitions for the alt:V JS module v2 shared types",
"types": "index.d.ts",
"files": [
Expand Down

0 comments on commit 6ebfa08

Please sign in to comment.