TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
PerformanceObserver types should be narrowed and corrected - unusable without suppressing atm
https://github.com/microsoft/TypeScript/blob/main/lib/lib.dom.d.ts#L10642
Should have the return type specific to the passed value or string if generic string only (see https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver/supportedEntryTypes for possible values)
Atm, one has to specify a @type to get rid of false errors, but even then, it will give error TS2322 (but this is a false positive too)
/**
* @type {PerformanceNavigationTiming[]}
*/
const navigation = performance.getEntriesByType( 'navigation' );
The web-vitals package provides it https://github.com/GoogleChrome/web-vitals/blob/dfdf57d112a33ec3cd29e7bc293b253274e4e38d/src/types.ts#L60-L87.