pusher-redux
pusher-redux copied to clipboard
Typescript Support
Is it possible to add types to this package?
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;
}```
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.
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
@tristanhcole any updates on the TS support?