【问题标题】:Typescript linter: reference to external libraryTypescript linter:对外部库的引用
【发布时间】:2021-08-19 15:32:00
【问题描述】:

我想为 Bokeh 编写一个自定义组件,这意味着我必须编辑一个与其环境有些“断开”的 TypeScript 文件。我的问题是如何使 linting 正常工作。

即我有一个带有标题的文件“component.ts”:

import * as p from "core/properties"
import {div, input} from "core/dom"
import {InputWidget, InputWidgetView} from "models/widgets/input_widget"

该文件深埋在 python 项目目录中。编译所有内容是 bokeh 的职责,它通过 Python 接口完成。但我知道这些包含在我的磁盘中的位置。我可以让我的 IDE 更好,让它知道如何在没有所有红色下划线的情况下搜索这些内容吗?

【问题讨论】:

    标签: typescript visual-studio-code bokeh bokehjs


    【解决方案1】:

    添加到tsconfig.json 这些行:

    {
        "compilerOptions": {
            ...
            "paths" : {
                "core/*": ["/path/to/core/*"],
                "models/*": ["/path/to/models/*"]
            }
        },
        "include": ["path/to/component.ts"],
        ...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-13
      • 2021-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多