Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
000f9cb3
Commit
000f9cb3
authored
Apr 21, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Apr 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate warn-once to TS
parent
11b0e004
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
warn-once.ts
src/shared/warn-once.ts
+3
-4
No files found.
src/shared/warn-once.
j
s
→
src/shared/warn-once.
t
s
View file @
000f9cb3
/** @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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment