Skip to content

Commit

Permalink
fix: ExtractItemValue returned by t.
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Oct 12, 2024
1 parent a6ed283 commit 2599ed0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gramio/i18n",
"version": "1.0.2",
"version": "1.0.3",
"description": "i18n plugin for GramIO with type-safety",
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand Down
8 changes: 5 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export type ExtractArgsParams<Item extends LocaleItem> =

export type ExtractItemValue<
Item extends LocaleItem,
FallbackItem extends LocaleItem,
> = Item extends never | undefined | unknown
? FallbackItem
FallbackItem extends LocaleItem = never,
> = [Item] extends [never]
? [FallbackItem] extends [never]
? never
: ExtractItemValue<FallbackItem>
: Item extends LocaleArgs
? ReturnType<Item>
: Item;
Expand Down

0 comments on commit 2599ed0

Please sign in to comment.