jonschlinkert/gray-matter

Typings issue when passing js-yaml options

sinedied opened this issue · 1 comments

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.

chmac commented

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.