Commit 000f9cb3 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Migrate warn-once to TS

parent 11b0e004
/** @type {Set<string>} */ const shownWarnings = new Set<string>();
let shownWarnings = new Set();
/** /**
* Log a warning if it has not already been reported. * Log a warning if it has not already been reported.
...@@ -7,12 +6,12 @@ let shownWarnings = new Set(); ...@@ -7,12 +6,12 @@ let shownWarnings = new Set();
* This is useful to avoid spamming the console if a warning is emitted in a * This is useful to avoid spamming the console if a warning is emitted in a
* context that may be called frequently. * context that may be called frequently.
* *
* @param {...unknown} args - * @param args -
* Arguments to forward to `console.warn`. The arguments `toString()` values * Arguments to forward to `console.warn`. The arguments `toString()` values
* are concatenated into a string key which is used to determine if the warning * are concatenated into a string key which is used to determine if the warning
* has been logged before. * has been logged before.
*/ */
export function warnOnce(...args) { export function warnOnce(...args: unknown[]) {
const key = args.join(); const key = args.join();
if (shownWarnings.has(key)) { if (shownWarnings.has(key)) {
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment