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

why does onCLS return non CLS metrics? #358

Closed
jantimon opened this issue Jun 15, 2023 · 5 comments · Fixed by #356
Closed

why does onCLS return non CLS metrics? #358

jantimon opened this issue Jun 15, 2023 · 5 comments · Fixed by #356

Comments

@jantimon
Copy link

According to the typings onCLS can return CLS Metrics or generic Metrics:
webVitalMetricCollector_ts_—_isomorph

Is that a typing bug?

@tunetheweb
Copy link
Member

I can't repeat this, but I think this will be fixed with #356

@jantimon
Copy link
Author

hey @tunetheweb

thank you for your quick response

you can test the behaviour here:
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbwLACg5wgOwMIBkDKANKgL5wBmUEIcARAO4CmARgLQBuwMAhgDYDOAem4wYUYMwCuMYFloBuVKix58ACjUBjAQEo4AXgB8iVOnTb+AOkzcQjU2cGCzAPQD8D8wMuNMY4Iz8nnBOrh4oJDqKKEooQA

I tried #356 on my local system and it fixes my problems 👍

The tooltip is a little bit confusing but the type is correct:
entries: (PerformanceEntry | LayoutShift | FirstInputPolyfillEntry | NavigationTimingPolyfillEntry)[] & LayoutShift[]

Thank you :)

@tunetheweb
Copy link
Member

Yeah weirdly I get any on 3.3.2:

image

But yeah it looks like #356 does fix this:

image

@tunetheweb
Copy link
Member

Maybe your IDE is just cleverer than mine (I use VSCode)?

@jantimon
Copy link
Author

I am using VSCode too - but probably it was just an invalid cache on my side - restarting VSCode fixed my tooltip (using #356)

typings_cls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants