toml-node
toml-node copied to clipboard
✨ Improve type definition of `parse` function
Now users can optionally supply the type of the parsed data like the following:
const myData = toml.parse<MyData>(myInput);
// ^? MyData
instead of doing
const myData: MyData = toml.parse(myInput);
Notice that the default type is still any
thus both approach above works.
As an workaround to this, I augmented toml
with this ambient file:
toml.d.ts
declare module 'toml' {
export function parse<TOutput = any>(input: string): TOutput;
}
Hi @BinaryMuse! can you please review this one? it should be pretty straightforward :smiley: