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

Typescript types are incompletes #88

Open
AntoineEsteve opened this issue Jun 28, 2018 · 7 comments
Open

Typescript types are incompletes #88

AntoineEsteve opened this issue Jun 28, 2018 · 7 comments

Comments

@AntoineEsteve
Copy link

Hello,

We are using vue-rx with typescript and we encountered some issues:

  • In subscriptions we can access to the properties defined in data but the current vue-rx types say that we can't.

Note: It works if you use: subscriptions?: Observables | (() => Observables) instead of subscriptions?: Observables | ((this: V) => Observables). But i didn't make a pull request because i am not sure that we can access to the props when subscriptions is called.

  • this is not extended with the data set by the subscriptions. So we can not access to the current values in the methods etc.
@regou regou assigned regou and unassigned regou Jun 28, 2018
@Terry-bear
Copy link

I have a same issue

@olivewind
Copy link

Is there a solution?

@ananiy
Copy link

ananiy commented Sep 14, 2018

I have same issue

@regou
Copy link
Collaborator

regou commented Sep 14, 2018

I’m not familiar with ts type definitions, pull requests are welcomed.
Or @keego give a check?

@minuukang
Copy link

So I made a decorator binding lib.

https://github.com/MinuKang/vue-rx-decorators

@alexsasharegan
Copy link

I'm also noticing that things like props and methods aren't inferred for the component. Would adding the full set of generics fix this? This is what I mean:

declare module "vue/types/options" {
    interface ComponentOptions<
        V extends Vue,
        Data = DefaultData<V>,
        Methods = DefaultMethods<V>,
        Computed = DefaultComputed,
        PropsDef = PropsDefinition<DefaultProps>,
        Props = DefaultProps
    > {
        subscriptions?: Observables | ((this: V) => Observables);
        domStreams?: string[]
        observableMethods?: string[] | Record<string, string>
    }
}

@raybog
Copy link

raybog commented Jul 11, 2019

I would like to use $fromDOMEvent('input', 'keyup') inside my class component to have access to properties and methods. Is this possible? Something like this:

export default class MyComponent extends Vue {
.... 
private name;

private handleNameInput(observable: Observable<any>):Observable<any> {
   return observable.pipe(
    ......
   );
 }

 public created() {
   this.handleNameInput($fromDOMEvent('input', 'keyup')).subscribe(
     result => this.name = result
   )
 } 
....
}

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

No branches or pull requests

8 participants