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

add missing interfaces for sub-classes of PerformanceEntry #59166

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

heysujal
Copy link

@heysujal heysujal commented Jul 7, 2024

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 interface 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.

Signed-off-by: Sujal Gupta <sujalgupta6100@gmail.com>
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jul 7, 2024
@heysujal
Copy link
Author

heysujal commented Jul 7, 2024

@microsoft-github-policy-service agree

@heysujal heysujal marked this pull request as draft July 7, 2024 19:52
@heysujal
Copy link
Author

heysujal commented Jul 7, 2024

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.

@heysujal heysujal marked this pull request as ready for review July 11, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
2 participants