funnel-graph-js icon indicating copy to clipboard operation
funnel-graph-js copied to clipboard

Add TypeScript?

Open felipefialho opened this issue 5 years ago • 5 comments

I've been adding a TypeScript interface to use funnel-graph-js in my project. Follows the code if you want to create a TypeScript version here 😄

export interface IFunnelGraph {
  container: string;
  gradientDirection: 'horizontal' | 'vertical';
  data: {
    colors: string[];
    labels: string[];
    values: number[];
  };
  displayPercent: boolean;
  direction: 'horizontal' | 'vertical';
  height: number;
  width: number;
  subLabelValue: 'percent' | 'raw';
  draw: () => {};
  makeVertical: () => {};
  makeHorizontal: () => {};
  toggleDirection: () => {};
  gradientMakeVertical: () => {};
  gradientMakeHorizontal: () => {};
  gradientToggleDirection: () => {};
  updateHeight: () => {};
  updateWidth: () => {};
  updateData: (data: any) => {};
  update: (options: any) => {};
}

Thanks for your project ❤️

felipefialho avatar Sep 17 '19 19:09 felipefialho

Hi @felipefialho , thank you very much! I have no TypeScript experience, is it possible to incorporate your code somehow in the library to make it usable for both JS and TS?

greghub avatar Sep 17 '19 19:09 greghub

Hi @greghub, answering your question... Yes! You can code your library to make it usable for JS and TS. The following article has a good explanation about how to do that: https://medium.com/cameron-nokes/the-30-second-guide-to-publishing-a-typescript-package-to-npm-89d93ff7bccd

muriloamendola avatar Sep 17 '19 21:09 muriloamendola

any update for Typescript support?

yourtraffix avatar Feb 01 '21 09:02 yourtraffix

waiting for this

maitrungduc1410 avatar Jan 17 '23 12:01 maitrungduc1410