add missing interfaces for sub-classes of PerformanceEntry
Fixes #58644
The interface were missing for subclasses of PerformanceEntry which causes an error when we try to run below code snippet Playground Link
function pageWasRealoaded(): boolean {
return performance
.getEntriesByType('navigation')
// Error: TS2339: Property type does not exist on type PerformanceEntry
// This is wrong, because this is a PerformanceNavigationTiming object
.some(entry => entry.type === 'reload');
}
I have added missing interfaces for different subclasses for every return type which can be found here. All of them inherit from PerformanceEntry interface.
I found that some interfaces were missing some properties. For example PerformanceResourceTiming.initiatorType
I think there are still changes that needs to be done. Thanks @lll000111 for guiding me. Please provide feedback.
@microsoft-github-policy-service agree
I have now found that I might need to add interfaces in webworker.generated.d.ts because the issue is not resolved yet. Earlier, I compiled the code to JavaScript and ran that compiled code. I missed that TypeScript compiler is still throwing the same error.
I just found that some entry types are not supported by getEntriesByType(). See here. I added interfaces for them too, earlier.
So, now I have decided to remove the getEntriesByType entries from the interface of Performance for those types that are not supported by getEntriesByType() method
@RyanCavanaugh The issue is still not solved, can you please help me with this? Update : I will start working on this again.