You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the typesOutputPath option, the package generates a file containing a Record of (abstracted for this issue) type KeyMap = Record<string, string | KeyMap> which in itself is working fine.
The issue stems from how the key paths are generated, which creates keys with "sub"-keys that are unusable ('admin' | 'admin.labels'| [...]). See picture below for a clearer picture on what I'm trying to say :
In the example above, only 'admin.emails.register.body.cta-button' and 'admin.emails.register.body.greetings' should be shown (this example is trimmed down), as all the keys above them are unusable keys that are generated via the export type Path and its sister types PathImpl2 and PathImpl as inlined below :
This makes it awkward to use the generated keys, and I've barely started translating my app I'm already having way too many entries in the intellisense (so much that I'm currently disabling the generated typings option in favour of a vscode extension, which makes my app error-prone at typescript's compile time).
I believe this especially happens with nested keys (see example below), but I could be wrong on this as I haven't tested every single scenario yet.
Reproduction
Even the starter example with few nested keys does it
Describe the bug
When using the
typesOutputPath
option, the package generates a file containing a Record of (abstracted for this issue)type KeyMap = Record<string, string | KeyMap>
which in itself is working fine.The issue stems from how the key paths are generated, which creates keys with "sub"-keys that are unusable (
'admin' | 'admin.labels'| [...]
). See picture below for a clearer picture on what I'm trying to say :In the example above, only
'admin.emails.register.body.cta-button'
and'admin.emails.register.body.greetings'
should be shown (this example is trimmed down), as all the keys above them are unusable keys that are generated via theexport type Path
and its sister typesPathImpl2
andPathImpl
as inlined below :nestjs-i18n/src/types.ts
Lines 27 to 33 in 6b1bb3a
This makes it awkward to use the generated keys, and I've barely started translating my app I'm already having way too many entries in the intellisense (so much that I'm currently disabling the generated typings option in favour of a vscode extension, which makes my app error-prone at typescript's compile time).
I believe this especially happens with nested keys (see example below), but I could be wrong on this as I haven't tested every single scenario yet.
Reproduction
Even the starter example with few nested keys does it
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: