<commit_before>// Type definitions for react-chartjs-2 2.0
// Project: https://github.com/jerairrest/react-chartjs-2
// Definitions by: <NAME> <https://github.com/apare>
//                 <NAME> <https://github.com/FabienLavocat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

import * as React from "react";
import * as chartjs from "chart.js";

export type ChartDataFunction<T extends chartjs.ChartData> = (
  element: HTMLElement
) => T;
export type ChartData<T extends chartjs.ChartData> = ChartDataFunction<T> | T;

export interface ChartComponentProps {
  data: ChartData<chartjs.ChartData>;
  type?: chartjs.ChartType;
  getDatasetAtEvent?(e: any): void;
  getElementAtEvent?(e: any): void;
  getElementsAtEvent?(e: any): void;
  height?: number;
  legend?: chartjs.ChartLegendOptions;
  onElementsClick?(e: any): void; // alias for getElementsAtEvent (backward compatibility)
  options?: chartjs.ChartOptions;
  redraw?: boolean;
  width?: number;
}

export interface LinearComponentProps extends ChartComponentProps {
  data: ChartData<chartjs.ChartData>;
}

export default class ChartComponent<
  P extends ChartComponentProps
> extends React.Component<P, {}> {
  chartInstance: chartjs;
}

export class Doughnut extends ChartComponent<ChartComponentProps> {}

export class Pie extends ChartComponent<ChartComponentProps> {}<commit_msg>Added missing ChartComponent prop types (#281)<commit_after>// Type definitions for react-chartjs-2 2.0
// Project: https://github.com/jerairrest/react-chartjs-2
// Definitions by: <NAME> <https://github.com/apare>
//                 <NAME> <https://github.com/FabienLavocat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

import * as React from "react";
import * as chartjs from "chart.js";

export type ChartDataFunction<T extends chartjs.ChartData> = (
  element: HTMLElement
) => T;
export type ChartData<T extends chartjs.ChartData> = ChartDataFunction<T> | T;

export interface ChartComponentProps {
  data: ChartData<chartjs.ChartData>;
  type?: chartjs.ChartType;
  getDatasetAtEvent?(e: any): void;
  getElementAtEvent?(e: any): void;
  getElementsAtEvent?(e: any): void;
  height?: number;
  legend?: chartjs.ChartLegendOptions;
  onElementsClick?(e: any): void; // alias for getElementsAtEvent (backward compatibility)
  options?: chartjs.ChartOptions;
  plugins?: object[];
  redraw?: boolean;
  width?: number;
  datasetKeyProvider: (any) => any;
}

export interface LinearComponentProps extends ChartComponentProps {
  data: ChartData<chartjs.ChartData>;
}

export default class ChartComponent<
  P extends ChartComponentProps
> extends React.Component<P, {}> {
  chartInstance: chartjs;
}

export class Doughnut extends ChartComponent<ChartComponentProps> {}

export class Pie extends ChartComponent<ChartComponentProps> {}
{'fraction_non_alphanumeric': 0.11940298507462686, 'fraction_numerical': 0.0052065255119750084, 'mean_word_length': 5.080168776371308, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 32, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1392645', 'n_tokens_mistral': 868, 'n_tokens_neox': 868, 'n_words': 222}