question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use isType with async properties

See original GitHub issue

Hi, I have the following:

interface ILanguage {
  first: string
  second?: string
}
const actionCreator = actionCreatorFactory( '[Language]' )
export const addLangAction = actionCreator.async<
    ILanguage, { success: number }, { error: number }>( 'ADD_DATA' )

export function langReducer( state: ILanguage, action: Action ) {
  if ( isType( action, addLangAction) ) {
    return action.payload
  }
  return state
}

The addLangAction generates the following error:

ERROR in language.store.ts (90,24): Argument of type 'AsyncAction
Creators<ILanguage, { success: number; }, { error: number; }>' is not assignable to parameter of type 'ActionCreator<{}>'.
  Type 'AsyncActionCreators<ILanguage, { success: number; }, { error: number; }>' provides no match for the signature '(payload
: {}, meta?: Object): Action<{}>')

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cloolcommented, Mar 20, 2017

I would love to see one for redux-thunk, thanks. great library and great work!

0reactions
ttamminencommented, Jun 17, 2017

@clool #19 is an issue that tracks the progress of a 3rd party helper library for the redux-thunk.

The good news is that there is a new project now available!

I think this issue can be closed now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.net - The proper way to await databound property getters c#
I have a blog post and MSDN article on "async properties" for data binding. I do take the stance that they are not...
Read more >
async function - JavaScript - MDN Web Docs - Mozilla
Use of async and await enables the use of ordinary try / catch blocks around asynchronous code. Note: The await keyword is only...
Read more >
Type 'typeof ResultAsync' is not a valid async function return ...
I'm having trouble with my very first steps with this library. I'm trying something very simple like: async function foo(): Promise { return...
Read more >
Documentation - Utility Types - TypeScript
Constructs an object type whose property keys are Keys and whose property values are Type . This utility can be used to map...
Read more >
Unit test controller logic in ASP.NET Core - Microsoft Learn
Unit testing controllers · Mocks the IBrainstormSessionRepository service using the GetTestSessions method. GetTestSessions creates two mock ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found