Add recharts-scale (#29186)

* Add recharts-scale

* Use path mapping to import

* file should end with new line
This commit is contained in:
John Reilly
2018-09-25 17:10:18 +01:00
committed by GitHub
parent 8063ab4a2e
commit 71dee33843
5 changed files with 71 additions and 0 deletions

29
types/recharts-scale/index.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
// Type definitions for Recharts 1.0
// Project: https://github.com/recharts/recharts-scale
// Definitions by: John Reilly <https://github.com/johnnyreilly>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/**
* Calculate the ticks of an interval
* @param [minAndMax] min: The minimum value, max: The maximum value
* @param tickCount The count of ticks
* @param allowDecimals Allow the ticks to be decimals or not - defaults to true
*/
export function getTickValues(domain: [number, number], tickCount?: number, allowDecimals?: boolean): number[];
/**
* Calculate the ticks of an interval
* @param [minAndMax] min: The minimum value, max: The maximum value
* @param tickCount The count of ticks
* @param allowDecimals Allow the ticks to be decimals or not - defaults to true
*/
export function getNiceTickValues(domain: [number, number], tickCount?: number, allowDecimals?: boolean): number[];
/**
* Calculate the ticks of an interval
* @param [minAndMax] min: The minimum value, max: The maximum value
* @param tickCount The count of ticks
* @param allowDecimals Allow the ticks to be decimals or not - defaults to true
*/
export function getTickValuesFixedDomain(domain: [number, number], tickCount?: number, allowDecimals?: boolean): number[];

View File

@@ -0,0 +1,9 @@
import {
getTickValues,
getNiceTickValues,
getTickValuesFixedDomain
} from 'recharts-scale';
getTickValues([1, 10], 6, false);
getNiceTickValues([1, 10], 6, false);
getTickValuesFixedDomain([1, 10], 6, false);

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"recharts-scale-tests.ts"
]
}

View File

@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-any-union": false
}
}

View File

@@ -15,6 +15,7 @@
// TypeScript Version: 2.8
import * as React from 'react';
import { getTickValues, getNiceTickValues, getTickValuesFixedDomain } from 'recharts-scale';
import { CurveFactory } from 'd3-shape';
export type Percentage = string;