Skip to content

Success results are always optional now #64

@jollytoad

Description

@jollytoad

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions