Skip to content

Types inject does not support number argument #9439

@pikax

Description

@pikax

Vue version

3.3.5

Link to minimal reproduction

https://play.vuejs.org/#eNp9UctOwzAQ/BXLlxYpSlT1VgISoB7gAAg4+hIl2+KS2Ja9CZWi/Du7bpMW8YgUyTszux7v9PLGubRrQa5kHkqvHYoA2LprZXTjrEfRC+dtpytIhIeNGMTG20bMqGc2ae5s4454mnHBI2eXyihzbJ4vErFYXCiTZ4dr6AIqEBpXFwhUCZHHMRmd82wiZCIxlNZs9DbdBWvIaM9iJUtS6xr8k0NtTVByJSLDXFHX9vMhYuhbSEa8fIfy4xd8F/aMKfnsIYDvQMmJw8JvAQ/0+vUR9nSeyMZWbU3qf8gXCLZu2eNBdtuaimyf6aLb+7hKbbZvYb1HMGF8FBtl5RD1StJqeVF/Pf1kd5kuY58yA21xjOVn0v4sa212UOL3lInnn0IIKIpCXB1Vc8qT8FOiXJwSpYod5ZXupoK/vuchwzAJslFxHvvwBbtN3dI=

Steps to reproduce

See Comp.vue file

What is expected?

Inject to not give typescript error if a number is passed

What is actually happening?

getting the error

System Info

No response

Any additional comments?

provide seems to accept number as key, the parameter will be converted to a string so

provide(1, 42)

inject(1) // 42

inject('1') // 42

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions