Skip to content

Commit

Permalink
Merge 9487c00 into 0949a2b
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmeziere committed Apr 8, 2024
2 parents 0949a2b + 9487c00 commit 5fcc866
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions typescript/t.d.ts
Expand Up @@ -116,8 +116,8 @@ type ParseKeysByFallbackNs<Keys extends $Dictionary> = _FallbackNamespace extend
? Keys[UnionFallbackNs]
: Keys[_FallbackNamespace & string];

type FilterKeysByContext<Keys, TOpt extends TOptions> = TOpt['context'] extends string
? Keys extends `${infer Prefix}${_ContextSeparator}${TOpt['context']}${infer Suffix}`
type FilterKeysByContext<Keys, Context> = Context extends string
? Keys extends `${infer Prefix}${_ContextSeparator}${Context}${infer Suffix}`
? `${Prefix}${Suffix}`
: never
: Keys;
Expand All @@ -128,12 +128,13 @@ export type ParseKeys<
KPrefix = undefined,
Keys extends $Dictionary = KeysByTOptions<TOpt>,
ActualNS extends Namespace = NsByTOptions<Ns, TOpt>,
const Context extends TOpt['context'] = TOpt['context'],
> = $IsResourcesDefined extends true
? FilterKeysByContext<
| ParseKeysByKeyPrefix<Keys[$FirstNamespace<ActualNS>], KPrefix>
| ParseKeysByNamespaces<ActualNS, Keys>
| ParseKeysByFallbackNs<Keys>,
TOpt
Context
>
: string;

Expand Down

0 comments on commit 5fcc866

Please sign in to comment.