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 Support #22

Open
tristanhcole opened this issue Jun 25, 2020 · 4 comments
Open

Typescript Support #22

tristanhcole opened this issue Jun 25, 2020 · 4 comments

Comments

@tristanhcole
Copy link

Is it possible to add types to this package?

@tristanhcole
Copy link
Author

tristanhcole commented Jun 25, 2020

I started drafting up something like this for an index.d.ts file.... new to typescript... would love some feedback/help on this.

import { StoreCreator } from 'redux'
import Options from 'pusher-js/src/core/options'
import Pusher from 'pusher-js/src/core/pusher'

declare module "pusher-redux" {
    export function setPusherClient(
        PusherClient: Pusher
    ): any;

    export function configurePusher(
        store: StoreCreator,
        apiKey: string,
        options?: Options
    ): any;

    export function delayConfiguration(
        store: StoreCreator,
        apiKey: string,
        options?: Options
    ): any;

    export function startConfiguration(
        options?: Options
    ): any;

    export function subscribe(
        channelName: string,
        eventName: string,
        actionType: string,
        additionalParams: any
    ): any;

    export function unsubscribe(
        channelName: string,
        eventName: string,
        actionType: string,
    ): any;

    export function getChannel(
        channelName: string
    ): any;

    export function disconnect(): any;

    let CONNECTED: string;
    let DISCONNECTED: string;
    let CONNECTING: string;
    let UNAVAILABLE: string;
    let FAILED: string;
}```

@TheRusskiy
Copy link
Owner

hey @tristanhcole
thanks for this effort!
I am a bit swamped with other work lately and don't have a current project that uses pusher-redux to test it on.

As for your code it's a great start, it can be polished further of course, but hopefully, you and others find it useful already.
I don't think I can merge this yet, but these typings can be used separately from this repo.

@tristanhcole
Copy link
Author

hey @tristanhcole
thanks for this effort!
I am a bit swamped with other work lately and don't have a current project that uses pusher-redux to test it on.

As for your code it's a great start, it can be polished further of course, but hopefully, you and others find it useful already.
I don't think I can merge this yet, but these typings can be used separately from this repo.

No worries @TheRusskiy! Thanks for the reply. I'll try to improve the typing of these and put in a PR once it's further along

@devinrhode2
Copy link

@tristanhcole any updates on the TS support?

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

No branches or pull requests

3 participants