John Yani

Results 263 comments of John Yani

In addition, we don't want payload to be present: ``` export type Action = Payload extends void ? { type: string; error?: boolean; meta?: Meta; } : { type: string;...

The issue is that you can't use void as a parameter type in generic: ``` function testAsyncGenericStrictError(params: P, result: R, error: E) { const async = actionCreator.async('ASYNC'); // you can't...

So it means the default value should be changed to something else that can be type guarded: ``` ( type: string, commonMeta?: Meta, isError?: boolean, ): ActionCreator; ``` Should be...

Here's how similar issue fixed in redux-toolkit: https://github.com/reduxjs/redux-toolkit/pull/133/files#diff-438bbd0288b07c3e7ae7f40f89f7f451R9-R11 ``` export type SliceActionCreator = P extends void ? () => PayloadAction : (payload: P) => PayloadAction ```

Oh, this looks even better: https://github.com/reduxjs/redux-toolkit/pull/138 ``` export type SliceActionCreator = [P] extends [void] ? () => PayloadAction : (payload: P) => PayloadAction ```

Well, it breaks a lot of things. Maybe someone else would have a better luck.

Pushed a new version with fixed generics

Published these changed to `typescript-fsa-vanuan` and `typescript-fsa-reducers-vanuan`

This appears to be an issue of parameter destructuring where default value contains typescriptBraces. ![image](https://user-images.githubusercontent.com/361985/71795584-90510580-304f-11ea-8ff0-67cd7537fed5.png)