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

Success results are always optional now #64

Open
jollytoad opened this issue Aug 24, 2018 · 2 comments
Open

Success results are always optional now #64

jollytoad opened this issue Aug 24, 2018 · 2 comments
Milestone

Comments

@jollytoad
Copy link

Hi, I've just tried updating to TS 3.0.1 and ts-fsa 3.0.0-beta-2, i previously had this generic reducer...

const mergeResultIntoIndex = <T extends Identified>(state: Indexed<T>, {result}: Success<any, T>): Indexed<T> => {
    return {
        ...state,
        [result.id]: result
    }
}

where:

export interface Identified {
    readonly id: string
}

export type Indexed<V> = { [id: string]: V }

but now i'm seeing the error:

TS2418: Type of computed property's value is 'T | undefined', which is not assignable to type 'T'.

for the line:

        [result.id]: result
@jollytoad
Copy link
Author

I should say, I was on TS 2.9.2 & ts-fsa 2.5.0 previously.

@aikoven
Copy link
Owner

aikoven commented Aug 27, 2018

Thanks for your report. Looks like the typings of 3.0.0-beta-2 don't handle this case well.

Meanwhile, you can use typescript-fsa@2.5.0.

@aikoven aikoven added this to the v4.0 milestone Sep 14, 2019
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

2 participants