Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import plugin using TypeScript #2483

Closed
eamodio opened this issue Dec 31, 2021 · 1 comment
Closed

Import plugin using TypeScript #2483

eamodio opened this issue Dec 31, 2021 · 1 comment
Labels
bug type.d Type definition related

Comments

@eamodio
Copy link

eamodio commented Dec 31, 2021

I'm having trouble getting TypeScript to import any plugins properly.

I was able to get my build to work by importing the BubbleCompare plugin as:

import * as Bubblecompare from 'billboard.js/dist/plugin/billboardjs-plugin-bubblecompare';

or

import Bubblecompare from 'billboard.js/dist/plugin/billboardjs-plugin-bubblecompare';

But in neither case can I seem to get the types to import with them. Instead I've has to add the following to a .d.ts file:

declare module 'billboard.js/dist/plugin/billboardjs-plugin-bubblecompare';

Any suggestions on how to properly import them?

FYI, I've also tried to import the esm version, but that has the same typing problem, but then additionally causes webpack compile issues:
Module not found: Error: Package path ./dist-esm/plugin/billboardjs-plugin-bubblecompare is not exported from package C:\Users\Eric\code\gitkraken\vscode-gitlens\node_modules\billboard.js (see exports field in C:\Users\Eric\code\gitkraken\vscode-gitlens\node_modules\billboard.js\package.json)

@eamodio
Copy link
Author

eamodio commented Dec 31, 2021

I was able to get the types to apply by adding the following to a .d.ts file:

declare module 'billboard.js/dist/plugin/billboardjs-plugin-bubblecompare' {
	import BubbleCompare from 'billboard.js/types/plugin/bubblecompare';

	export = BubbleCompare;
}

But that isn't ideal.

@netil netil added type.d Type definition related bug labels Jan 3, 2022
netil added a commit to netil/billboard.js that referenced this issue Jan 5, 2022
Generate type.d file on dist folder to make plugin modules
to resolve corresponding type definition file

Ref naver#2483
@netil netil closed this as completed in f3690f9 Jan 5, 2022
github-actions bot pushed a commit that referenced this issue Jan 5, 2022
# [3.3.0-next.2](3.3.0-next.1...3.3.0-next.2) (2022-01-05)

### Bug Fixes

* **event:** fix touch event handling on arc ([d3d2e05](d3d2e05)), closes [#2477](#2477)
* **types:** Fix plugin's type definition ([f3690f9](f3690f9)), closes [#2483](#2483)

### Features

* **axis:** alow user to hide tick lines while using culling ([aad8c45](aad8c45)), closes [#2478](#2478) [#2480](#2480)
* **bar:** Intent to ship bar.indices.removeNull ([b16605d](b16605d)), closes [#1687](#1687)
github-actions bot pushed a commit that referenced this issue Jan 14, 2022
# [3.3.0](3.2.2...3.3.0) (2022-01-14)

### Bug Fixes

* **api:** Ensure svg nodes to be removed from memory  ([f49ed83](f49ed83)), closes [#2489](#2489)
* **event:** fix touch event handling on arc ([d3d2e05](d3d2e05)), closes [#2477](#2477)
* **text:** Fix text position with candlestick type combination ([f84ab3e](f84ab3e)), closes [#2436](#2436)
* **tooltip:** fix candlestick tooltip display with xs option ([0278067](0278067)), closes [#2434](#2434)
* **types:** Fix axis types definition ([92fb033](92fb033)), closes [#2499](#2499)
* **types:** Fix plugin's type definition ([f3690f9](f3690f9)), closes [#2483](#2483)

### Features

* **axis:** alow user to hide tick lines while using culling ([aad8c45](aad8c45)), closes [#2478](#2478) [#2480](#2480)
* **bar:** add non zero based bar chart ([3588abe](3588abe)), closes [#2408](#2408) [#2438](#2438)
* **bar:** Implement stacking bar radius ([8f14d1a](8f14d1a)), closes [#2428](#2428)
* **bar:** Intent to ship bar.indices.removeNull ([b16605d](b16605d)), closes [#1687](#1687)
* **option:** Enhance padding to be removed completely ([2052a19](2052a19)), closes [#2367](#2367)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type.d Type definition related
Projects
None yet
Development

No branches or pull requests

2 participants