@docusaurus/module-type-aliases 0.0.0-4072 → 0.0.0-4076

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.d.ts +12 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/module-type-aliases",
3
- "version": "0.0.0-4072",
3
+ "version": "0.0.0-4076",
4
4
  "description": "Docusaurus module type aliases.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -19,5 +19,5 @@
19
19
  "@types/react-router-dom": "*"
20
20
  },
21
21
  "license": "MIT",
22
- "gitHead": "3ffe0ce0e463209aaaad5d1a54230765f7cf9c24"
22
+ "gitHead": "f04e8a18292194fee7fe318b8afb908cfbb2074e"
23
23
  }
package/src/index.d.ts CHANGED
@@ -141,16 +141,16 @@ declare module '@docusaurus/Interpolate' {
141
141
  }
142
142
 
143
143
  declare module '@docusaurus/Translate' {
144
- import type {
145
- InterpolateProps,
146
- InterpolateValues,
147
- } from '@docusaurus/Interpolate';
148
-
149
- export type TranslateParam<Str extends string> = Partial<
150
- InterpolateProps<Str>
151
- > & {
152
- message: Str;
153
- id?: string;
144
+ import type {ReactNode} from 'react';
145
+ import type {InterpolateValues} from '@docusaurus/Interpolate';
146
+
147
+ // TS type to ensure that at least one of id or message is always provided
148
+ // (Generic permits to handled message provided as React children)
149
+ type IdOrMessage<MessageKey extends 'children' | 'message'> =
150
+ | ({[key in MessageKey]: string} & {id?: string})
151
+ | ({[key in MessageKey]?: string} & {id: string});
152
+
153
+ export type TranslateParam<Str extends string> = IdOrMessage<'message'> & {
154
154
  description?: string;
155
155
  values?: InterpolateValues<Str, string | number>;
156
156
  };
@@ -160,9 +160,9 @@ declare module '@docusaurus/Translate' {
160
160
  values?: InterpolateValues<Str, string | number>,
161
161
  ): string;
162
162
 
163
- export type TranslateProps<Str extends string> = InterpolateProps<Str> & {
164
- id?: string;
163
+ export type TranslateProps<Str extends string> = IdOrMessage<'children'> & {
165
164
  description?: string;
165
+ values?: InterpolateValues<Str, ReactNode>;
166
166
  };
167
167
 
168
168
  export default function Translate<Str extends string>(