Typings issue when passing js-yaml options #107

Open
opened 2020-05-15 13:31:05 +00:00 by sinedied · 1 comment
sinedied commented 2020-05-15 13:31:05 +00:00 (Migrated from github.com)

When trying to pass js-yaml options to stringify method, there is a type error:

matter.stringify(file, file.data, { lineWidth: -1 });
// >Type '{ lineWidth: number; }' has no properties in common with type 'GrayMatterOption<string, GrayMatterOption<string, unknown>>'.ts(2559)

Since any kind of options (depending of the engine) can be passed here, the GrayMatterOption type is missing something here (or maybe I missed something?).

Thanks for helping.

When trying to pass `js-yaml` options to `stringify` method, there is a type error: ```ts matter.stringify(file, file.data, { lineWidth: -1 }); // >Type '{ lineWidth: number; }' has no properties in common with type 'GrayMatterOption<string, GrayMatterOption<string, unknown>>'.ts(2559) ``` Since any kind of options (depending of the engine) can be passed here, the `GrayMatterOption` type is missing something here (or maybe I missed something?). Thanks for helping.
chmac commented 2022-01-29 16:17:49 +00:00 (Migrated from github.com)

I have the same issue, passing {skipInvalid: true} as an option is passed to js-yaml, but the typescript types fail.

Workaround seems to be casting the options to any like matter.stringify(a, b, {skipInvalid: true} as any), but if the types also merged in the js-yaml types that would be awesome.

I have the same issue, passing `{skipInvalid: true}` as an option is passed to js-yaml, but the typescript types fail. Workaround seems to be casting the options to any like `matter.stringify(a, b, {skipInvalid: true} as any)`, but if the types also merged in the js-yaml types that would be awesome.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rtlabs-llm-agents/gms-gray-matter#107
No description provided.