Closed alexgorbatchev closed 5 years ago
I think the error message is pretty clear. .pkg
can be undefined
as it might not find a package.json file. You need to guard that somehow. If you're absolutely sure there's a package.json file there, you could do readPkgUp.sync({cwd: fileName}).pkg!.name
, though it would not recommend it. I'm also confused by your naming of your argument fileName
being passed to the cwd
option, which expects a path to a directory.
I'm having an issue with importing the packages after native types were introduces (vs
@types/read-pkg-up
. I've triedimport * as from
andimport ... = from
, same results for both using TypeScript 3.5.1