Skip to content

[BUG] Inconsistent getLocale return type (string | undefined) #6812

@codercody

Description

@codercody

Why does getLocale have return type () => string | undefined in useTranslation if getLocale has type () => string in i18nProvider?

export type UseGetLocaleType = () => () => string | undefined;

type GetLocaleFunction = () => string;

It's annoying having to say const locale = getLocale() || "en" or const locale = getLocale()! when we already know the return type will be string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions