Open sod opened 22 hours ago
satisfies
is not the same as an inferred or explicitly annotated type. customByLanguage
has the more specific type of { de: string }
and no index or record signature. If you want the wider type, just use that:
const customByLanguage: Partial<Record<Language, string>> = {
de: 'ipsum',
}
🔍 Search Terms
Example:
This error seems counter intuitive as a fallback if the property doesn't match was given via
?? fallback
. Right now I need to add either typescript or javascript boilerplate to get rid of this error.playground
✅ Viability Checklist
⭐ Suggestion
I'd expect typescript to not complain about lack of perfect key overlap if the nullish operator is being used to fallback if they key does not exist.
A bonus would be, if typescript still complained if key and object had no overlap at all, as that seems to be most likely an error.
💻 Use Cases
Now having to work with strict property access due to removal of
suppressImplicitAnyIndexErrors: false
in typescript 5.6