Skip to content

Commit

Permalink
types: use unknown to better infer types on nested t functions also f…
Browse files Browse the repository at this point in the history
…or older typescript version #2032
  • Loading branch information
adrai committed Sep 8, 2023
1 parent 2d42064 commit 54b5169
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 23.5.1

- types: use unknown to better infer types on nested t functions also for older typescript version [2032](https://github.com/i18next/i18next/issues/2032)

## 23.5.0

- types: use unknown to better infer types on nested t functions [2018](https://github.com/i18next/i18next/pull/2018)
Expand Down
5 changes: 4 additions & 1 deletion typescript/t.v4.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ type ParseInterpolationValues<Ret> =
| (Value extends `${infer ActualValue},${string}` ? ActualValue : Value)
| ParseInterpolationValues<Rest>
: never;
type InterpolationMap<Ret> = Record<$PreservedValue<ParseInterpolationValues<Ret>, string>, any>;
type InterpolationMap<Ret> = Record<
$PreservedValue<ParseInterpolationValues<Ret>, string>,
unknown
>;

type ParseTReturnPlural<
Res,
Expand Down

0 comments on commit 54b5169

Please sign in to comment.