Skip to content

Commit efc618b

Browse files
mpeyperjpeyper
andauthored
refactor: remove variable assignment in function name workaround
Co-authored-by: Jonathan Peyper <[email protected]>
1 parent 9944f14 commit efc618b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/core/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ function createRenderHook<TProps, TResult, TOptions extends {}, TRenderer extend
7777
}
7878

7979
// If the function name does not get used before it is returned,
80-
// it seems to vanish in nodejs and does not appear in stack traces.
80+
// it's name is removed by babel-plugin-minify-dead-code-elimination.
8181
// This dummy usage works around that.
82-
const _name = renderHook.name // eslint-disable-line @typescript-eslint/no-unused-vars
82+
renderHook.name // eslint-disable-line @typescript-eslint/no-unused-expressions
83+
8384

8485
return renderHook
8586
}

src/helpers/createTestHarness.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function createTestHarness<TProps, TResult>(
4141
}
4242

4343
// If the function name does not get used before it is returned,
44-
// it seems to vanish in nodejs and does not appear in stack traces.
44+
// it's name is removed by babel-plugin-minify-dead-code-elimination.
4545
// This dummy usage works around that.
46-
const _name = testHarness.name // eslint-disable-line @typescript-eslint/no-unused-vars
46+
testHarness.name // eslint-disable-line @typescript-eslint/no-unused-expressions
4747

4848
return testHarness
4949
}

0 commit comments

Comments
 (0)