作为 typescript 的新手用户(但 Bokeh 的经验丰富的用户),我正在尝试采用BokehJS 示例之一并独立运行它——这在 Bokeh git repo 的文件层次结构之外。
因此,例如,如果我想运行该burtin示例,我将.ts,.html和tsconfig.json(从目录的顶层examples)复制到一个新文件夹中。然后我可以修改文件中的linkandscript标记.html以指向相应资源的本地副本。当我尝试运行时tsc burtin.ts,我收到以下错误:
$ tsc burtin.ts
burtin.ts(2,16): error TS2304: Cannot find name 'Bokeh'.
burtin.ts(2,16): error TS2503: Cannot find namespace 'Bokeh'.
burtin.ts(3,27): error TS2304: Cannot find name 'Bokeh'.
burtin.ts(5,18): error TS2503: Cannot find namespace 'Bokeh'.
burtin.ts(6,16): error TS2503: Cannot find namespace 'Bokeh'.
burtin.ts(8,24): error TS2304: Cannot find name 'Bokeh'.
burtin.ts(9,3): error TS2304: Cannot find name 'Bokeh'.
burtin.ts(10,3): error TS2304: Cannot find name 'Bokeh'.
我如何告诉打字稿编译器在哪里找到Bokeh?tsconfig.json示例中有以下burtin内容:
{
"extends": "../tsconfig.json",
"files": [
"../../src/coffee/api/typings.d.ts",
"burtin.ts"
]
}
也许typings.d.ts告诉编译器在哪里寻找导出的 BokehJS 名称,但不清楚我是否需要完整的散景源代码库来编译示例(typings.d.ts文件不包括在内conda install bokeh)。
任何有关如何设置此示例并独立运行它的见解都将不胜感激。
更新:即使tsc抛出错误,它仍然会产生工作burtin.js并且 html 页面正确显示。我只是不清楚是否有更优化的方法来设置开发环境。