@lang-tag/cli 0.20.0 → 0.21.0
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/package.json
CHANGED
|
@@ -25,11 +25,27 @@ import React, {
|
|
|
25
25
|
interface TagConfig extends LangTagTranslationsConfig {
|
|
26
26
|
keep?: 'namespace' | 'path' | 'both'
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Ensures the Tag type compiles into a named alias rather than an expanded structural type,
|
|
31
|
+
* preventing bloated .d.ts output during tag generation and keeping exported definitions clean.
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
34
|
+
export namespace {{tagName}} {
|
|
35
|
+
export type Tag<T extends LangTagTranslations> = {
|
|
36
|
+
useTranslations: () => CallableTranslations<T>;
|
|
37
|
+
initTranslations: (translations?: PartialFlexibleTranslations<T>) => CallableTranslations<T>;
|
|
38
|
+
Provider(props: { translations?: PartialFlexibleTranslations<T>; children: ReactNode }): ReactNode;
|
|
39
|
+
InputType: PartialFlexibleTranslations<T>;
|
|
40
|
+
Type: CallableTranslations<T>;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
{{/isTypeScript}}
|
|
29
|
-
export function {{tagName}}<T extends LangTagTranslations>(
|
|
45
|
+
export function {{tagName}}{{#isTypeScript}}<T extends LangTagTranslations>{{/isTypeScript}}(
|
|
30
46
|
baseTranslations: T,
|
|
31
47
|
config?: TagConfig,
|
|
32
|
-
) {
|
|
48
|
+
){{#isTypeScript}}: {{tagName}}.Tag<T>{{/isTypeScript}} {
|
|
33
49
|
const createTranslationHelper = (normalized{{#isTypeScript}}: CallableTranslations<T> | null{{/isTypeScript}}) =>
|
|
34
50
|
createCallableTranslations(baseTranslations, config, {
|
|
35
51
|
transform: ({unprefixedPath, value, params}) => {
|