Typescript nested generic resolves to unknown
Am I missing something?
In the following example, shouldn't the type of
Instead it says it's of type
Did I reach the limits of Typescript?
In the following example, shouldn't the type of
result resolve to { test: { title: 'test' } }?Instead it says it's of type
Record<string, unknown>Did I reach the limits of Typescript?
Solution
In the end I actually went with this:
It is a translate composable which uses the current locale given by Nuxt i18n.
I tried
See final options on typescript play
It is a translate composable which uses the current locale given by Nuxt i18n.
I tried
function translate<T>(data: { translations: Record<string, T> }) but that resolved to object instead.See final options on typescript play
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
