Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(fromEvent): fix type error of element reference #4728

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

Merged
merged 6 commits into from
May 14, 2025

Conversation

ywenhao
Copy link
Contributor

@ywenhao ywenhao commented Apr 25, 2025

…e 'HTMLElement'`

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Description

image
image

fix typescript error.

Additional context

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 25, 2025
@@ -16,6 +16,8 @@ import { shallowRef } from 'vue'

const count = shallowRef(0)
const button = shallowRef<HTMLButtonElement | null>(null)
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just change it to useTemplateRef.

@@ -35,7 +35,9 @@ import { concatAll, map, mergeMap, pluck, scan, take } from 'rxjs/operators'
import { ref } from 'vue'

const BASE_URL = 'https://jsonplaceholder.typicode.com'
const button = ref<HTMLButtonElement>(null)
const button = ref<HTMLButtonElement | null>(null)
Copy link
Member

Choose a reason for hiding this comment

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

same here

@ilyaliao
Copy link
Member

Do we need to handle the case where the element might be null? After we remove the type warning

@ywenhao
Copy link
Contributor Author

ywenhao commented Apr 25, 2025

Do we need to handle the case where the element might be null? After we remove the type warning

Yes. Of course.

ilyaliao
ilyaliao previously approved these changes Apr 27, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 27, 2025
OrbisK
OrbisK previously approved these changes May 4, 2025
Copy link
Collaborator

@OrbisK OrbisK left a comment

Choose a reason for hiding this comment

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

lgtm

antfu
antfu previously approved these changes May 14, 2025
@antfu antfu added this pull request to the merge queue May 14, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch May 14, 2025
@antfu antfu dismissed stale reviews from OrbisK, ilyaliao, and themself via 7b33428 May 14, 2025 04:55
@antfu antfu changed the title fix(fromEvent): fix ts error: Type 'null' is not assignable to type 'HTMLElement fix(fromEvent): fix type error of element reference May 14, 2025
@antfu antfu added this pull request to the merge queue May 14, 2025
Merged via the queue into vueuse:main with commit 94fea43 May 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.