【问题标题】:JSDoc with Typescript error for Interace: ERROR: Unable to parseJSDoc 与 Interace 的 Typescript 错误:错误:无法解析
【发布时间】:2020-06-04 04:52:17
【问题描述】:

我尝试在 react typescript 项目中使用 JSDocs,但对于具有接口的文件出现此错误

错误:无法解析 C:******* /file.ts:此实验性语法 需要启用以下解析器插件之一:'flow, 打字稿' (1:7

谢谢

【问题讨论】:

    标签: typescript jsdoc


    【解决方案1】:

    经过一些研究发现这个项目 cal better-docs 它适用于 jsdocs 并在 jsdoc.conf.json 上添加依赖项和以下配置可解决问题并允许使用 typescript 来解决问题(直到现在)

    {
    "tags": {
        "allowUnknownTags": true,
        "dictionaries": ["jsdoc","closure"]
    },
    "source": {
        "include": ["src"],
        "includePattern": "\\.(jsx|js|ts|tsx)$",
        "excludePattern": "(^|\\/|\\\\)_"
    },
    "plugins": [
        "node_modules/better-docs/typescript"
    
    ],
    "typescript": {
        "moduleRoot": "test"
    },
     "templates": {
      "better-docs": {
          "name": "My React components"
        }
    },
    "opts": {
        "template": "node_modules/better-docs",
        "destination": "docs",
        "recurse": true,
        "readme": "README.md"
    }
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-18
      • 2018-05-02
      • 2023-02-04
      • 1970-01-01
      • 2011-02-23
      • 2018-03-08
      • 2018-07-14
      相关资源
      最近更新 更多