-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(node): 'Illegal invocation' in 'perf_hooks' module #1410
Conversation
node/perf_hooks_test.ts
Outdated
perfHooks.performance.measure!("test"); | ||
perfHooks.performance.mark!("test"); | ||
perfHooks.performance.clearMarks!("test"); | ||
perfHooks.performance.now!(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These not-null assertions are unlucky, but without them I get:
TS2722 [ERROR]: Cannot invoke an object which is possibly 'undefined'.
perfHooks.performance!.now();
~~~~~~~~~~~~~~~~~~~~~~~~~~
at file:///Users/biwanczuk/dev/deno_std/node/perf_hooks_test.ts:13:5
@kitsonk can you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it comes from const performance: Partial<Performance>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I solved it by using Omit<>
instead of Partial<>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, yeah, Omit<>
is a lot better here.
No description provided.