LoginSignup
5
1

More than 5 years have passed since last update.

typedocハマりポイント

Posted at

typedocでドキュメントを作成してみたときのハマりポイントの備忘録。

@types/highlight.jsで Cannot find name 'Node' と言われる

tsconfig.jsonのcompilerOptions.libに"dom"を追加します。

tsconfig.json
{
  "compilerOptions": {
    "lib": ["es2015", "es2016", "es2017", "dom"]
  }
}

exportしてない変数とかがドキュメントに表示される

実行時に--excludeNotExportedオプションを付けます。

typedoc --out docs --excludeNotExported

生成物をgithub pagesで表示したときに下層ページが404になってしまう

_で始まるファイルはデフォルトで弾かれるので、github pagesの対象ディレクトリのルートに.nojekyllファイルを置きます。個人的には以下のようにpackage.jsonを設定して、npm run docsでドキュメントが生成されるようにしています。

package.json
{
  "scripts": {
    "docs:build": "typedoc --out docs --excludeNotExported",
    "docs:touch-nojeykll": "nodetouch docs/.nojekyll",
    "docs": "run-s docs:build docs:touch-nojeykll"
  },
  "devDependencies": {
    "npm-run-all": "^4.0.2",
    "touch": "^3.1.0",
    "typedoc": "^0.7.1"
  }
}
5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1