eemeli / yaml

YAML parser and stringifier for JavaScript
https://eemeli.org/yaml
ISC License
1.32k stars 117 forks source link

Properties missing from `stringify` options parameter #592

Closed akuntsch closed 10 hours ago

akuntsch commented 11 hours ago

Describe the bug The type of the stringify options parameter is missing properties like lineWidth as documented at https://eemeli.org/yaml/#tostring-options and also suggested at https://github.com/eemeli/yaml/issues/58#issuecomment-799334277.

To Reproduce

YAML.stringify({ abc: 'def' }, { lineWidth: 120 });

shows a TypeScript error with lineWidth does not exist in type Options.

Expected behaviour All documented option properties are working as expected in TypeScript (I'm not sure if only the type is incorrect or the implementation as well).

Versions (please complete the following information):

Additional context I've declared YAML as a global variable via a .d.ts file, but the error also shows up, if I import the yaml module via import YAML from 'yaml'.

eemeli commented 10 hours ago

Please check and confirm your yaml version, Options has not been used as a type for a while now.

eemeli commented 10 hours ago

To be specific, that type only showed up in exactly one prerelease version: 2.0.0-4.

akuntsch commented 10 hours ago

Thanks @eemeli for the very fast response and for pointing me in the right direction!

I'm actually an idiot... my package.json had a resolution pointing yaml to v1.10.2. Works as expected after removing that resolution.