docts icon indicating copy to clipboard operation
docts copied to clipboard

Error: The "path" argument must be of type string

Open Worie opened this issue 7 years ago • 3 comments

Hi, just wanted to try your package - it seems like a really handy tool! However, I've got some troubles using it. I've installed it, added it to dependencies, added a script to run it - and my README.md file has ## API section that could be replaced with the contents generated from docts.

However, I seem to have a problem with generatc the content. Perhaps you could have a look and point me to the solution? I'm not sure whether I've an issue with the structure of my app or its something else.

If you want, you can see my current setup where it occurs here: btt-node

path.js:28
    throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'path', 'string');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1184:7)
    at new DocBuilder (btt-node/node_modules/docts/dist/DocBuilder.js:37:29)
    at Object.patchReadme (btt-node/node_modules/docts/dist/Patcher.js:19:9)
    at Object.<anonymous> (btt-node/node_modules/docts/dist/cli.js:6:11)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (btt-node/node_modules/docts/bin/docts:3:1)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)

Thanks in advance!

Worie avatar Jun 23 '18 09:06 Worie

I am also seeing this. It looks like it is because docts assumes a typings field will be present in package.json: https://github.com/charto/docts/blob/2673605d429e38d025daecaca07d37414b31f544/src/DocBuilder.ts#L47

But typescript now supports types also, which people mostly use now. This should be updated to use whichever one it finds first.

bschlenk avatar Sep 09 '18 19:09 bschlenk

Should be fixed by https://github.com/charto/docts/commit/68a576c379024701adac7923415dc26234a66eae.

bschlenk avatar Sep 10 '18 20:09 bschlenk

Thank you so much for the report and PR!

I'm working on supporting TypeScript 3 and will release soon, at least with this issue fixed.

jjrv avatar Sep 11 '18 06:09 jjrv