Skip to content
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

[node] Fix property 'detail' of PerformanceEntry #55724

Merged
merged 3 commits into from Sep 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/node/perf_hooks.d.ts
Expand Up @@ -84,7 +84,7 @@ declare module 'perf_hooks' {
* Additional detail specific to the `entryType`.
* @since v16.0.0
*/
readonly details?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
}
/**
* _This property is an extension by Node.js. It is not available in Web browsers._
Expand Down
8 changes: 4 additions & 4 deletions types/node/test/perf_hooks.ts
Expand Up @@ -48,9 +48,9 @@ const performanceObserverCallback: PerformanceObserverCallback = (list, obs) =>
const name: string = entries[0].name;
const startTime: number = entries[0].startTime;
const entryTypes: EntryType = entries[0].entryType;
const details: NodeGCPerformanceDetail = entries[0].details as NodeGCPerformanceDetail;
const kind: number | undefined = details.kind;
const flags: number | undefined = details.flags;
const detail: NodeGCPerformanceDetail = entries[0].detail as NodeGCPerformanceDetail;
const kind: number | undefined = detail.kind;
const flags: number | undefined = detail.flags;

if (kind === constants.NODE_PERFORMANCE_GC_MAJOR) {
if (flags === constants.NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY) {
Expand All @@ -64,7 +64,7 @@ obs.observe({
entryTypes: ['gc'],
});
obs.observe({
type: 'gc'
type: 'gc',
});

const monitor: IntervalHistogram = monitorEventLoopDelay({
Expand Down