-
Notifications
You must be signed in to change notification settings - Fork 345
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
Missing UnwrapRef export #247
Comments
I'm no sure why you'd need that type. |
Having it exported, would allow it use that instead of declaring it again, for example, I'm building an library with composables, and sometime I need to access to On my case I described the types: export type UnwrapType<T> = T extends Ref<infer R> ? R : T;
export type WrapType<T> = T extends Ref<any> ? T : Ref<T>;
export function unwrap(o: RefElement): Element;
export function unwrap<T>(o: RefTyped<T>): T;
export function unwrap<T>(o: RefTyped<T>): T {
return isRef(o) ? o.value : o;
}
export function wrap(o: RefElement): Ref<Element>;
export function wrap<T>(o: RefTyped<T>): Ref<T>;
export function wrap<T>(o: RefTyped<T>): Ref<T> {
return isRef(o) ? o : ref(o);
} EDIT: EDIT2: There's a few functions not exported in this plugin, but exported on the |
In my case I would like to use a reactive object (with |
@spaceemotion what do you mean? can you provide an example of how you would expect it to happen? |
This seems to be covered in #311 |
Yes we can close it once #311 is merged |
I wanted to switch a couple fields that belong together from individual
ref()
's to a singlereactive()
. Since I am using TypeScript, I tried to import the UnwrapRef type, but instead of using the main import, it redirected me to its full path instead:I can import this:
but need to do this for UnwrapRef:
has this been an oversight, or is there a reason (like, "probably don't want to use reactive at all")?
Edit: I also noticed that
Refs
seems to be missing?The text was updated successfully, but these errors were encountered: