Skip to content

Eslint complains about typescript with custom shortcuts: "Property 'today' is incompatible with index signature." #131

@israelpossoli

Description

@israelpossoli

How i use shortcuts with typescript?

My shortcuts:

configs={{
    shortcuts: {
        today: "Hoje",
        yesterday: "Ontem",
        past: (period) => `Últimos ${period}  dias`,
        currentMonth: "Este mês",
        pastMonth: "Mês passado",
    }
}}

Error:
Type '{ today: string; yesterday: string; past: (period: number) => string; currentMonth: string; pastMonth: string; }' is not assignable to type '{ today?: string | undefined; yesterday?: string | undefined; past?: ((period: number) => string) | undefined; currentMonth?: string | undefined; pastMonth?: string | undefined; } & { ...; }'.
Property 'today' is incompatible with index signature.
Type 'string' has no properties in common with type 'ShortcutsItem'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions