Skip to content

fix(runtime-core): inject supports number type parameters. #9450

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

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

Conversation

lumozx
Copy link

@lumozx lumozx commented Oct 21, 2023

closes #9439
The implementation of provide is based on Object. However, if the key is a number, it will be converted to a string. Therefore, there is no good way to distinguish between number and string.
For example:

provide(1, 1)
provide('1', 2)

inject(1)  // 1
inject('1')  // 2

So, this commit only modifies the type hints.

@lumozx lumozx marked this pull request as draft October 21, 2023 04:59
@lumozx lumozx marked this pull request as ready for review October 21, 2023 05:28
@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB 32.7 kB 29.5 kB
vue.global.prod.js 132 kB 49.4 kB 44.3 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.9 kB 17.2 kB
createSSRApp 50.7 kB 20 kB 18.2 kB
defineCustomElement 50.3 kB 19.7 kB 18 kB
overall 61.3 kB 23.7 kB 21.6 kB

@shaobeichen
Copy link

shaobeichen commented Oct 23, 2023

Thanks for the pull request, but I think provide and inject were not designed with the Number type as a standard solution in the first place, and this issue is yet to be investigated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Types inject does not support number argument
3 participants