Skip to content

Remove unnecessary type assertions from useReport.ts#5884

Merged
StyleT merged 2 commits intofacebook:mainfrom
2wheeh:unnecessary-type-assertion
Apr 16, 2024
Merged

Remove unnecessary type assertions from useReport.ts#5884
StyleT merged 2 commits intofacebook:mainfrom
2wheeh:unnecessary-type-assertion

Conversation

@2wheeh
Copy link
Copy Markdown
Contributor

@2wheeh 2wheeh commented Apr 13, 2024

I believe this is better for type-safety

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 13, 2024 8:07pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 13, 2024 8:07pm

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 13, 2024
if (timer !== null) {
clearTimeout(timer.current as ReturnType<typeof setTimeout>);
if (timer.current !== null) {
clearTimeout(timer.current);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're in here, semantically it would make sense to also set timer.current = null; after clearing, although the clearTimeout API doesn't really care if it's called with invalid ids

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! I added on 153cd4c

Copy link
Copy Markdown
Contributor

@potatowagon potatowagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@potatowagon potatowagon changed the title Remove unnecessary type assertions Remove unnecessary type assertions from packages/lexical-playground/src/hooks/useReport.ts Apr 15, 2024
@potatowagon potatowagon changed the title Remove unnecessary type assertions from packages/lexical-playground/src/hooks/useReport.ts Remove unnecessary type assertions from useReport.ts Apr 15, 2024
@StyleT StyleT merged commit aba3160 into facebook:main Apr 16, 2024
@acywatson acywatson mentioned this pull request Apr 16, 2024
@2wheeh 2wheeh deleted the unnecessary-type-assertion branch April 17, 2024 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants