@zonos/amino 5.6.1 → 5.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/__amino__/TranslateAminoText.d.ts +1 -1
- package/components/translations/Translate.d.ts +14 -1
- package/package.json +1 -1
- package/tsconfig.emitDeclarationOnly.tsbuildinfo +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/translations/_handleTranslateComponentText.d.ts +0 -14
- package/utils/translations/_handleTranslationVariables.d.ts +1 -7
- package/utils/translations/translate.d.ts +7 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { TranslateProps } from "
|
|
2
|
+
import type { TranslateProps } from "../translations/Translate";
|
|
3
3
|
import type { AminoTranslationStrings } from "../../utils/translations/AminoTranslationStore";
|
|
4
4
|
/**
|
|
5
5
|
* Amino-only Translate component with type safety.
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SupportedLanguageCode } from "../../utils/translations/supportedLanguages";
|
|
3
|
+
import type { ExtractVariables } from "../../utils/translations/translate";
|
|
4
|
+
/**
|
|
5
|
+
* Require variables argument to be an object with keys that match the variables in the string.
|
|
6
|
+
* If no variables are present, variables argument is optional.
|
|
7
|
+
*/
|
|
8
|
+
export type TranslateProps<T extends string> = {
|
|
9
|
+
languageCode?: SupportedLanguageCode;
|
|
10
|
+
text: T;
|
|
11
|
+
} & (ExtractVariables<T> extends never ? {
|
|
12
|
+
variables?: never;
|
|
13
|
+
} : {
|
|
14
|
+
variables: Record<ExtractVariables<T>, ReactNode>;
|
|
15
|
+
});
|
|
3
16
|
export declare const Translate: <T extends string>(props: TranslateProps<T>) => ReactNode;
|