Closed marvinroger closed 7 years ago
Thanks, @marvinroger.
Curious, why the change in the return type from Object
to any
?
Sure: take a look at this example. You'll see the console.log(parsed.foo)
is underlined in red, meaning it did not "pass" the static type checking. The reason is actually pretty simple: you can use the Object
type only if you know in advance what properties the object will contain - like parameters of a method -. This is not our case, so we have to use any
. See also Basic Types#any
@marvinroger Got it, thanks! (Not a TypeScript user if you couldn't tell :P)
Published as v2.3.1
This PR adds TypeScript types definition, allowing the module to be used from a TypeScript file.
It would be great if you could minor bump and publish this to npm after the PR is merged. Thanks!