-
-
Notifications
You must be signed in to change notification settings - Fork 380
Open
Labels
Status: ProposalRequest for commentsRequest for comments
Description
Clear and concise description of the problem
We can setup autocompletion with typescript but we can't make typescript throws an error if we try to translate a non existing key.
import type fr from "../i18n/fr.json";
const { t } = useI18n<{ message: typeof fr }>();
const translation = t("key.non_existing"); // doesn't throw a typescript errorSuggested solution
Update the types to make typescript throws an error.
Alternative
Adding <""> makes typescript throws:
import type fr from "../i18n/fr.json";
const { t } = useI18n<{ message: typeof fr }>();
const translation = t<"">("key.non_existing"); // ts throws error as exepectedAdditional context
No response
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
Status: ProposalRequest for commentsRequest for comments