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

Reducer TypeScript definitition for combineReducers #115

Open
jeroenlandheer opened this issue Aug 22, 2020 · 2 comments
Open

Reducer TypeScript definitition for combineReducers #115

jeroenlandheer opened this issue Aug 22, 2020 · 2 comments

Comments

@jeroenlandheer
Copy link

jeroenlandheer commented Aug 22, 2020

I'm having some issues here to get the i18SnState reducer to get into my combineReducers() function. TypeScript complains that the type is not compatible with Reducer<IreduxI18nState> because of the state parameter not accepting undefined in the definition.

My workaround is this line of code:

export const reducer: Reducer<IreduxI18nState> = (state: IreduxI18nState | undefined, incomingAction: Action): IreduxI18nState => i18nState(state, incomingAction);

I think (not 100% sure) this can be solved by changing the signature of the this line in index.d.ts:

export function i18nState(state: IreduxI18nState, action: Action): IreduxI18nState

to

export function i18nState(state: IreduxI18nState | undefined, action: Action): IreduxI18nState
@wijnbladh
Copy link

Additionally, it would seem that this:

  export interface IGetTranslateFunctionResponse {
      (textKey: string, params?: string[], comment?: string): string;
  }

should be like this, or something:

  export interface IGetTranslateFunctionResponse {
      (textKey: string, params?: { [key: string]: string }, comment?: string): string;
  }

(based on looking at the source code)

@JosephBrooksbank
Copy link
Contributor

Any updates on this? index.d.ts still appears to be incorrect, at least with regards to IGetTranslateFunctionResponse.

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