Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2307: Cannot find module 'path'. #43

Open
bluelovers opened this issue Apr 19, 2018 · 8 comments
Open

error TS2307: Cannot find module 'path'. #43

bluelovers opened this issue Apr 19, 2018 · 8 comments

Comments

@bluelovers
Copy link

ts-docs-gen 0.2.0

error TS2307: Cannot find module 'path'.

but i have @types/node in my node_modules

@MartynasZilinskas
Copy link
Collaborator

Could you write here your tsconfig.json?

@bluelovers
Copy link
Author

{
  "compilerOptions": {
    "module": "CommonJS",
    "target": "es2017",

    "moduleResolution": "node",
    "allowJs": false,

    "declaration": true,
    "experimentalDecorators": true,

    "allowSyntheticDefaultImports": true,

    "strict": false,

    "locale": "zh-TW",
    "pretty": true,

    "traceResolution": true,
    "newLine": "lf"
  },

  "jsdoc": "jsdoc",

  "exclude": [
    "node_modules",
    "test"
  ]
}

@MartynasZilinskas
Copy link
Collaborator

I think, your tsconfig.json is missing types property:

{
    "compilerOptions": {
        "types": ["node"]
    }
}

An example from this project tsconfig.json

@bluelovers
Copy link
Author

@MartynasZilinskas

can output now
but looks like still something wrong

when i confing this

{
 "entryFile": [
   "index.ts",
   "lib/loader/index.ts",
   "lib/loader/segment/index.ts"
  ]
}

the output dir only has one md file

and it is api about lib/loader/segment/index.ts


when i confing this

{
 "entryFile": [
   "index.ts",
  ]
}

api only has index.ts it self (not include any other require...)


i trying use on node-segment-dict

@MartynasZilinskas
Copy link
Collaborator

What TypeScript version do you use? Because I don't see it in package.json. I installed newest TypeScript 2.8.3 and got errors while trying to compile it.

lib/loader/opencc/index.ts:46:16 - error TS2503: Cannot find namespace 'libLoader'.

46 export default libLoader.load;
                  ~~~~~~~~~


lib/loader/segment/index.ts:115:16 - error TS2503: Cannot find namespace 'Loader'.

115 export default Loader.load;
                   ~~~~~~

@MartynasZilinskas
Copy link
Collaborator

MartynasZilinskas commented Apr 21, 2018

@bluelovers Could you make a separate branch with ts-docs-gen installed? So I could inspect tool's behavior.

@bluelovers
Copy link
Author

https://github.com/bluelovers/node-segment-dict/tree/ts-docs-gen

ts version: 2.9.0-dev.20180420
ts version: 2.8.1

(install on global

@MartynasZilinskas
Copy link
Collaborator

@bluelovers Thanks.

ts-docs-gen log:

[13:23:44] warn: D:/Projects/Temp/node-segment-dict/index.ts(10,8): Declaration "ImportClause" is not supported yet.
[13:23:44] warn: D:/Projects/Temp/node-segment-dict/index.ts(11,10): Exported item does not exist.
[13:23:44] warn: D:/Projects/Temp/node-segment-dict/index.ts(10,25): Imported item does not exist.
[13:23:44] warn: D:/Projects/Temp/node-segment-dict/index.ts(13,8): Declaration "ImportClause" is not supported yet.
[13:23:44] warn: D:/Projects/Temp/node-segment-dict/index.ts(14,10): Exported item does not exist.
[13:23:44] warn: D:/Projects/Temp/node-segment-dict/index.ts(20,1): Declaration "ExportAssignment" is not supported yet.
[13:23:44] warn: ./index.ts(11,9): ApiItems are missing in "requireLoader"?
[13:23:44] warn: ./index.ts(10,24): ApiItems are missing in "requireModule"?
[13:23:44] warn: ./index.ts(14,9): ApiItems are missing in "getDictPath"?

I have inspected your code. Some TypeScript's declarations are not supported yet by our ts-extractor. We haven't encountered this usage, because we don't use default exports/imports.

I will reproduce your project cases and add them as tests.

For now, we are busy rewriting ts-extractor with a new and better structure, then it will be turn for ts-docs-gen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants