typescriptvisual-studio-codebokehbokehjs

Typescript linter: reference to external library


I want to write a custom component for Bokeh, that means that I have to edit a TypeScript file that is somewhat "disconnected" from its environment. My question is how to make linting work properly.

Namely I have a file "component.ts" with header:

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

The file is buried deep in a python project directory. Compiling everything is bokeh's responsibility and it does it from its Python interface. But I know where those includes are located in my disk. Can I make my IDE nicer so it knows how to search that stuff without all those red underlines?


Solution

  • Add to tsconfig.json these lines:

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