Typedoc: 0.20 does not find custom declaration files

Created on 2 Jan 2021  Â·  9Comments  Â·  Source: TypeStrong/typedoc

I just upgraded to 0.20.9 - PR here https://github.com/AndyOGo/stylelint-declaration-strict-value/pull/131

However I still can't build the docs.
It doesn't find my custom declaration files for 2 modules.

But my normal lint and build with typescript works.

I also tried to a the typeRoots options, but without luck 😞
https://www.typescriptlang.org/tsconfig#typeRoots

> [email protected] docs /stylelint-declaration-strict-value
> typedoc --plugin typedoc-plugin-markdown src/index.ts

Loaded plugin typedoc-plugin-markdown

Error: /stylelint-declaration-strict-value/src/index.ts(2)
 Could not find a declaration file for module 'shortcss'. '/stylelint-declaration-strict-value/node_modules/shortcss/lib/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/shortcss` if it exists or add a new declaration (.d.ts) file containing `declare module 'shortcss';`
Error: /stylelint-declaration-strict-value/src/index.ts(3)
 Could not find a declaration file for module 'shortcss/lib/list'. '/stylelint-declaration-strict-value/node_modules/shortcss/lib/list.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/shortcss` if it exists or add a new declaration (.d.ts) file containing `declare module 'shortcss/lib/list';`
Error: /stylelint-declaration-strict-value/src/index.ts(4)
 Could not find a declaration file for module 'css-values'. '/stylelint-declaration-strict-value/node_modules/css-values/dist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/css-values` if it exists or add a new declaration (.d.ts) file containing `declare module 'css-values';

__Originally posted by @AndyOGo in https://github.com/TypeStrong/typedoc/issues/1089#issuecomment-753464183__

bug needs reproduction

All 9 comments

@AndyOGo

I can't seem to reproduce this, what I did:

git clone [email protected]:AndyOGo/stylelint-declaration-strict-value.git
cd stylelint-declaration-strict-value
npm install
npx typedoc --plugin typedoc-plugin-markdown src/index.ts

This resulted in the following output:

> npx typedoc --plugin typedoc-plugin-markdown .\src\index.ts
Info: Loaded plugin typedoc-plugin-markdown
Rendering [========================================] 100%
Info: Documentation generated at C:\Users\gtbir\Documents\GitHub\stylelint-declaration-strict-value\docs

The output looks to be as expected, there are three exported values, so three items in the documentation

@Gerrit0 thx for your quick reply.

I opened up a branch which has the issue.
https://github.com/AndyOGo/stylelint-declaration-strict-value/pull/132

I still can't seem to reproduce this, checking out that branch, then running npm i, npm run docs errors with:

~\Documents\GitHub\stylelint-declaration-strict-value [bugfix/docs-entry-point ≡]
> npm run docs

> [email protected] docs C:\Users\gtbir\Documents\GitHub\stylelint-declaration-strict-value
> typedoc --plugin typedoc-plugin-markdown src/index.ts

Info: Loaded plugin typedoc-plugin-markdown
Error: Tried to set an option (inputFiles) that was not declared.
Error: Tried to set an option (mode) that was not declared.

Removing those options from the options file:

diff --git a/typedoc.json b/typedoc.json
index 8066213..2bd7f78 100644
--- a/typedoc.json
+++ b/typedoc.json
@@ -1,6 +1,4 @@
 {
-  "inputFiles": ["./src/"],
-  "mode": "modules",
   "readme": "none",
   "out": "docs"
 }

Results in a working build:

~\Documents\GitHub\stylelint-declaration-strict-value [bugfix/docs-entry-point ≡ +0 ~1 -0 !]
> npm run docs

> [email protected] docs C:\Users\gtbir\Documents\GitHub\stylelint-declaration-strict-value
> typedoc --plugin typedoc-plugin-markdown src/index.ts

Info: Loaded plugin typedoc-plugin-markdown
Rendering [========================================] 100%
Info: Documentation generated at C:\Users\gtbir\Documents\GitHub\stylelint-declaration-strict-value\docs

Thank you, that is very interesting 🤔

I will try it.

Btw. which platform are you using?

I'm on Windows 10 Professional, not sure of the exact build.

I'm on macOS Catalina 10.15.7 (19H2)
node -v: v10.19.0
npm -v: 6.13.4

Alright, I removed the mode and inputFiles options.
https://github.com/AndyOGo/stylelint-declaration-strict-value/pull/132/files#diff-6169a21f84f4d19da38a12219c19778338487973f106b9dad94370e66e1c8c1a

Now I get these errors 😞

npm run docs

> [email protected] docs /stylelint-declaration-strict-value
> typedoc --plugin typedoc-plugin-markdown src/index.ts

Info: Loaded plugin typedoc-plugin-markdown
TypeDoc exiting with unexpected error:
TypeError: Right-hand side of 'instanceof' is not an object
    at ReflectionType.type (/stylelint-declaration-strict-value/node_modules/typedoc-plugin-markdown/dist/resources/helpers/type.js:27:14)
    at getType (/stylelint-declaration-strict-value/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js:30:24)
    at DeclarationReflection.declarationTitle (/stylelint-declaration-strict-value/node_modules/typedoc-plugin-markdown/dist/resources/helpers/declaration-title.js:22:124)
    at DeclarationReflection.wrapper (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js:15:19)
    at Object.eval [as main] (eval at createFunctionContext (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:262:23), <anonymous>:10:225)
    at main (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/runtime.js:208:32)
    at ret (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/runtime.js:212:12)
    at ret (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:519:21)
    at Object.invokePartial (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/runtime.js:334:12)
    at Object.invokePartialWrapper [as invokePartial] (/stylelint-declaration-strict-value/node_modules/handlebars/dist/cjs/handlebars/runtime.js:84:39)

Looks like you're running on an older version of typedoc-plugin-markdown that doesn't support 0.20.

@Gerrit0
Thank you very much.
I was on [email protected].
Upgrading to 3.2.1 made it work, even though there seems to be a breaking change somewhere, no major upgrade 🤔

Good to hear! Closing this as resolved then.

Was this page helpful?
0 / 5 - 0 ratings