Skip to content

Commit 688c0d2

Browse files
committed
🩹 Fix type error for keywords in metadata
The type of the `info` property in the document definition combines the `InfoProps` and `CustomInfoProps` types. This introduces a type conflict as the type of the `keywords` property (`string[]`) conflicts with the type of the values in `CustomInfoProps` (`string`). As a result, an assignment of the `keywords` property results in a type error. To fix this problem, we enforce the `XX` prefix for custom keys in the `info` property, following the recommendation. This could be considered a breaking change, however, it will only affect custom info attributes without the recommended `XX` prefix and the resulting type error can easily be suppressed.
1 parent 07fe0c3 commit 688c0d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/api/document.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export type CustomInfoAttrs = CustomInfoProps;
152152
* `XX` to avoid name collisions.
153153
*/
154154
export type CustomInfoProps = {
155-
[name: string]: string;
155+
[name: `XX${string}`]: string;
156156
};
157157

158158
/**

0 commit comments

Comments
 (0)