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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.provide is not type safe #10602

Open
makedopamine opened this issue Mar 27, 2024 · 0 comments · May be fixed by #10603
Open

app.provide is not type safe #10602

makedopamine opened this issue Mar 27, 2024 · 0 comments · May be fixed by #10603

Comments

@makedopamine
Copy link

makedopamine commented Mar 27, 2024

Vue version

3.4.21

Link to minimal reproduction

link

Steps to reproduce

Check out the reproduction

import { createApp, ref, provide } from "vue";
import type { InjectionKey, Ref } from "vue";

const app = createApp({});
type Cube = {
  size: number;
};
const injectionKeyRef:InjectionKey<Ref<Cube>> = Symbol('key');

app.provide(injectionKeyRef, ref({}))  // a type error should be thrown as in the following line
provide(injectionKeyRef, ref({}))

What is expected?

The type of app.provide is same with the type of provide

What is actually happening?

The type of app.provide is different with the type of provide

System Info

No response

Any additional comments?

Related: #8201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants