@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lang-tag/cli",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -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}) => {
@@ -0,0 +1,4 @@
1
+ The library’s return type is structured to avoid inflated compiled typings;
2
+
3
+ application-level code does not require this return type, as it is not emitted
4
+ for reuse in generated type definitions.