Giter VIP home page Giter VIP logo

Comments (10)

piotrwitek avatar piotrwitek commented on June 15, 2024 1

Hello @farzadmf
Currently not but it's because of TS v2.7 inference engine limitation.
Fortunately you will be able to do that with the new API in v2.0 I'm currently working on.

type CameraAction = ReturnType<typeof cameraActions.getCamerasSuccess>;
const receiveCameras = (state: CameraState, action: CameraAction) => {
...

I will open issue today for discussion/feedback on the API 2.0, new features like Symbols support, but also improvements to createAction (got rid of duplicated type argument finally :)) and probably push the working implementation to the next branch for testing.

EDIT: API v2.0 discussion here: #22

from typesafe-actions.

piotrwitek avatar piotrwitek commented on June 15, 2024 1

2 days top I think, I'm heavily working on it

from typesafe-actions.

duro avatar duro commented on June 15, 2024 1

@dziamid I have done so with success. I have a saga that looks like this:

import { sessionActions as SA } from './actions'

function* setToken(action: ReturnType<typeof SA.setToken>) { }

Where SA.setToken is an action that was built with typesafe-actions

from typesafe-actions.

farzadmf avatar farzadmf commented on June 15, 2024

Hello @piotrwitek thank you for your answer, So how I can I keep track of the new API version you mentioned and when it will available?

from typesafe-actions.

dziamid avatar dziamid commented on June 15, 2024

Looking forward to start using ReturnType. Can I just update TS to 2.8@rc and start using ReturnType with typesafe-actions?

from typesafe-actions.

dziamid avatar dziamid commented on June 15, 2024

@duro, sweet, was looking for the exact same use case. Are you using the version 1 of this library?

from typesafe-actions.

duro avatar duro commented on June 15, 2024

from typesafe-actions.

dziamid avatar dziamid commented on June 15, 2024

How exactly? Type and payload assertions are all I care about right now.

from typesafe-actions.

piotrwitek avatar piotrwitek commented on June 15, 2024

Hi @dziamid, for example this: #21 (comment)

from typesafe-actions.

piotrwitek avatar piotrwitek commented on June 15, 2024

Closing as issue seems to be unactionable.

from typesafe-actions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.