Skip to content

Commit ae97e73

Browse files
fix: updated models
- changed interfaces to types * 4.0.3 --------- Co-authored-by: GitHub Actions <[email protected]>
1 parent 049593c commit ae97e73

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "intl-react",
3-
"version": "4.0.2",
3+
"version": "4.0.3",
44
"type": "module",
55
"scripts": {
66
"dev": "vite",

src/models.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
export interface IntlProps {
1+
export type IntlProps = {
22
languages: Record<string, any>;
33
defaultLanguage: string;
44
detectBrowserLanguage?: boolean;
5-
}
6-
7-
export interface IntlContext {
5+
};
6+
export type IntlContext = {
87
locale: string;
98
setLocale: (language: string) => void;
109
languages: Record<string, any>;
1110
defaultLanguage: string;
12-
}
13-
11+
};
1412
export type TrContext = Omit<IntlContext, "setLocale">;
15-
1613
type KeyPrefix<T extends string> = T extends "" ? "" : `.${T}`;
17-
1814
type Suffix = "zero" | "one" | "two" | "few" | "many" | "female" | "male";
1915
type DynamicSuffix = Partial<Record<Suffix, string>>;
20-
2116
export type KeyPath<T> = (
2217
T extends DynamicSuffix
2318
? ""
@@ -29,14 +24,15 @@ export type KeyPath<T> = (
2924
) extends infer D
3025
? Extract<D, string>
3126
: never;
32-
33-
export type TParams = { count?: number; [key: string]: any };
34-
27+
export type TParams = {
28+
count?: number;
29+
[key: string]: any;
30+
};
3531
export type Autocomplete<schema> = KeyPath<schema>;
36-
37-
export interface UseTranslation extends IntlContext {
32+
export type UseTranslation = {
3833
T: <Key extends string, Params extends TParams>(
3934
key: Key,
4035
params?: Params,
4136
) => string;
42-
}
37+
} & IntlContext;
38+
export {};

0 commit comments

Comments
 (0)