Closed MistyKuu closed 5 years ago
is this lib still maintained?
@QuantumInformation Yes!
@MistyKuu That's because in 3.0 the ActionCreator
type is composed of two types using intersection (&
), which lets us use different signature when Payload
type is void
. However, with newer TypeScript versions this is no longer needed, because you can skip void parameters (see https://github.com/Microsoft/TypeScript/pull/27522).
There are a few other things I'd like to fix before releasing 3.0 stable, let's keep this open until then.
For now, you can safely continue to use 2.5.
And by the way, if what you're trying to achieve with this augmentation is extracting payload type from action creator type, you can use conditional types for that.
Cool thanks @aikoven
We are seeing this:
This happened after moving to the new native create react app --typescript.
@QuantumInformation Can you show the definition of SaveIssue
action creator?
export const SaveIssue = actionCreator.async<null, IssueDetails , string>('SaveIssue');
If I turn off "strict": true, no error.
before we just had
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": ["es6", "dom"],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noErrorTruncation": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,```
Fixed it updating the generic type
export const LoadIssue = actionCreator.async< null, IssueDetails , string>('LoadIssue'); to export const LoadIssue = actionCreator.async< {issueId: number}, IssueDetails , string>('LoadIssue');
Have you thought of setting up a discord server for this project, or adding it to reactiflux?
Have you thought of setting up a discord server for this project, or adding it to reactiflux?
There's not so much activity on this project. And honestly, I don't have much spare time to maintain a chat room.
ok, thx anyway
I'm currently using typescript-fsa version 2.5. I'm augmenting ActionCreator interface like this:
The reason I'm doing it is that I extended it with payloadType. In 3.0 I'm not able to do that since types in typescript cannot be augmented. Is there any reason why you decided to use type?