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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(watch): watchImmediate and watchDeep support overloads #2998

Merged
merged 1 commit into from Apr 19, 2023

Conversation

Mini-ghost
Copy link
Contributor

@Mini-ghost Mini-ghost commented Apr 19, 2023

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

Currently, the type for watchImmediate and watchDeep do not allow passing an array of multiple data sources. This PR addresses this issue by using overloads."

鎴湒 2023-04-19 涓嬪崍3 17 39


馃 Generated by Copilot at c6bd046

This pull request improves the functionality and organization of the watchDeep and watchImmediate functions, which allow reactive watchers for deep or immediate changes. It introduces a new type MultiWatchSources to handle multiple sources, and moves the functions to separate files under packages/shared.

馃 Generated by Copilot at c6bd046

  • Add watchDeep and watchImmediate functions to support watching multiple sources with deep or immediate options (link, link, link)
  • Use overloads with MapSources, MapOldSources, and Immediate types to infer source and callback types and omit redundant options (link, link)
  • Use fallback functions with default generic parameters, any casts, and relaxed source constraints to handle any arguments (link, link)
  • Move watchDeep and watchImmediate functions from their original files to packages/shared/utils/types.ts for better organization (link, link)

@antfu antfu merged commit 8f6a0c5 into vueuse:main Apr 19, 2023
4 checks passed
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 this pull request may close these issues.

None yet

2 participants