简体   繁体   中英

bokehjs with Angular: error while importing

we are trying to import @bokeh/bokehjs in angular 10 and 11 as below:

import * as Bokeh from '@bokeh/bokehjs';

However we are facing below issues while compiling. Compilation error

Error: node_modules/@bokeh/bokehjs/build/js/types/core/property_mixins.d.ts:115:30 - error TS1005: ']' expected.

115 [key in keyof T & string as ${P}_${key} ]: T[key]; ~~ node_modules/@bokeh/bokehjs/build/js/types/core/property_mixins.d.ts:115:46 - error TS1005: ';' expected.

115 [key in keyof T & string as ${P}_${key} ]: T[key]; ~ node_modules/@bokeh/bokehjs/build/js/types/core/property_mixins.d.ts:115:47 - error TS1128: Declaration or statement expected.

115 [key in keyof T & string as ${P}_${key} ]: T[key]; ~ node_modules/@bokeh/bokehjs/build/js/types/core/property_mixins.d.ts:116:1 - error TS1128: Declaration or statement expected.

116 };

Below are the bokehjs and node version we are using

  • bokehjs: 2.3.2

  • node: 14.17.3

Could anyone please help us fix this and let us know if there is anything we need to do

Thanks

Try to import just the required file from the build subdirectory.

Example:

import * as Bokeh from '@bokeh/bokehjs/build/js/lib/embed';

Refer this. I solved my problem using this:

https://discourse.bokeh.org/t/using-bokehjs-in-an-angular-app/5787/7

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM