Uh oh!
There was an error while loading. Please reload this page.
feat(utils): performance TS ext - #1213
Conversation
View your CI Pipeline Execution ↗ for commit a08b227
☁️ Nx Cloud last updated this comment at |
Code PushUp🤨 Code PushUp report has both improvements and regressions – compared current commit 7dbf3e3 with previous commit 7b6e72c. 🕵️ See full comparison in Code PushUp portal 🔍 🏷️ Categories👍 1 group improved, 👎 6 groups regressed, 👍 6 audits improved, 👎 16 audits regressed, 15 audits changed without impacting score🗃️ Groups
27 other groups are unchanged. 🛡️ Audits
642 other audits are unchanged. |
@code-pushup/ci@code-pushup/cli@code-pushup/core@code-pushup/create-cli@code-pushup/nx-plugin@code-pushup/models@code-pushup/axe-plugin@code-pushup/coverage-plugin@code-pushup/eslint-plugin@code-pushup/js-packages-plugin@code-pushup/jsdocs-plugin@code-pushup/lighthouse-plugin@code-pushup/typescript-plugin@code-pushup/utilscommit: |
Code PushUp🥳 Code PushUp report has improved – compared current commit 42e5f04 with previous commit 91f50cf. 💼 Project |
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🔴 42 | 🔴 42 |
5 other categories are unchanged.
👍 1 group improved, 👍 1 audit improved
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🔴 42 | 🔴 42 |
14 other groups are unchanged.
🛡️ Audits
| 🔌 Plugin | 🛡️ Audit | 📏 Previous value | 📏 Current value | 🔄 Value change |
|---|---|---|---|---|
| JSDocs coverage | Types coverage | 🟥 65 undocumented types | 🟥 65 undocumented types |
443 other audits are unchanged.
13 other projects are unchanged.
# Conflicts: # packages/utils/src/lib/performance-observer.ts
There was a problem hiding this comment.
Pull request overview
This PR extends Node’s perf_hooks typings with Chrome DevTools Extensibility API support and wires that through the profiler utilities so performance.mark/measure and trace encoding/decoding understand structured detail.devtools payloads.
Changes:
- Adds
perf-hooks.d.tsmodule augmentations and a type-focused test suite to giveperf_hooksentries/marks/measures a typeddetail.devtoolspayload and stricter mark/measure option typing. - Adjusts user-timing detail/DevTools payload types plus trace encode/decode utilities and tests to round-trip DevTools-style
detailstructures. - Updates TS configs and a report-loading test to include new
.d.tsfiles and reflect required configuration properties.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/utils/tsconfig.test.json | Includes top-level src/*.d.ts so type tests pick up local declaration files. |
| packages/utils/tsconfig.lib.json | Changes library outDir and include patterns to emit declarations alongside src and include new .d.ts files. |
| packages/utils/src/perf-hooks.type.test.ts | New type-only tests asserting the augmented perf_hooks APIs and DevTools payload typings; currently reference some undefined helper types. |
| packages/utils/src/perf-hooks.d.ts | New declaration file augmenting perf_hooks/node:perf_hooks with DevTools-aware entry, mark, measure, observer list, and performance typings. |
| packages/utils/src/lib/user-timing-extensibility-api.type.ts | Tightens WithDevToolsPayload/DetailPayloadWithDevtools/UserTimingDetail definitions to require devtools and adds a convenience detail type. |
| packages/utils/src/lib/reports/load-report.unit.test.ts | Updates loadReport tests to pass skipReports: false in line with the stricter PersistConfig typing. |
| packages/utils/src/lib/profiler/trace-file-utils.unit.test.ts | Adjusts expectations for encode/decode helpers and trace event helpers to work with DevTools-shaped detail.devtools payloads. |
| packages/utils/src/lib/profiler/trace-file-utils.ts | Generalizes encodeDetail/decodeDetail, adds encodeDetailToString, and updates trace encode/decode helpers to correctly handle JSON-string and object forms of DevTools detail payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| }) satisfies PerformanceEntryWithDevtools; | ||
| // Invalid examples | ||
| ({ |
There was a problem hiding this comment.
PerformanceEntryWithDevtools is referenced here but is not declared anywhere in the project, which will cause a TypeScript error (Cannot find name 'PerformanceEntryWithDevtools') when running the tests. Please either introduce this type (e.g. as a typed alias for PerformanceEntry with the detail payload) or change the tests to assert against an existing exported type instead.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "../../dist/out-tsc", | ||
| "outDir": "dist", |
There was a problem hiding this comment.
Changing compilerOptions.outDir to "dist" deviates from the convention used by other packages (e.g. packages/core/tsconfig.lib.json:4 and packages/cli/tsconfig.lib.json:4 still use "../../dist/out-tsc") and may break tooling or publish scripts that expect all library outputs under dist/out-tsc. Please double-check the build/publish configuration for this package and either keep the outDir consistent with the rest of the repo or update the consumers of the build output accordingly.
| }, | ||
| }, | ||
| }) satisfies PerformanceMeasureOptionsWithDevtools; | ||
| // Invalid examples |
There was a problem hiding this comment.
PerformanceMeasureOptionsWithDevtools is used here but is not declared anywhere in the codebase, so this test file will fail to type-check with Cannot find name 'PerformanceMeasureOptionsWithDevtools'. Either import/define this type (for example as an alias to the existing MeasureOptionsWithDevtools<...>), or update the test to use an existing exported type such as PerformanceMeasureOptions.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
BioPhoton
commented
Feb 3, 2026
Ill drop this feature in favour of our helpers that are fully compatible with all native APIs. |
Related to #1197
This PR includes:
perf-hooks.d.tstypes to extend performance APIs with Chrome DevTools Extensibility API types so we get autocomplete and type checks when using e.g.performance.mark('mark-name', { details: /*this is typed*/})