mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix: fix typescript type error in experience phrases
This commit is contained in:
parent
4ac4f8cdb4
commit
9024dd5cc2
1 changed files with 12 additions and 5 deletions
|
@ -1,10 +1,17 @@
|
|||
import type en from './locales/en/index.js';
|
||||
|
||||
type FlattenKeys<T, Prefix extends string = ''> = {
|
||||
type FlattenKeys<
|
||||
T,
|
||||
Prefix extends string = '',
|
||||
D extends number = 11, // Depth limit is actually 10, since the initial value of A is [0]
|
||||
A extends unknown[] = [0],
|
||||
> = A['length'] extends D
|
||||
? never
|
||||
: {
|
||||
[K in keyof T]: T[K] extends Record<string, unknown>
|
||||
? `${Prefix}${string & K}.${FlattenKeys<T[K]>}`
|
||||
? `${Prefix}${string & K}.${FlattenKeys<T[K], '', D, [0, ...A]>}`
|
||||
: `${Prefix}${string & K}`;
|
||||
}[keyof T];
|
||||
}[keyof T];
|
||||
|
||||
export type LocalePhrase = typeof en;
|
||||
|
||||
|
|
Loading…
Reference in a new issue