Added types for d3-interpolate-path package (#35828)

* Added types for reactour package

* added types for d3-interpolate-path package
This commit is contained in:
Paweł Dąbrowski 2019-05-30 21:05:35 +02:00 committed by Sheetal Nandi
parent 48fd0bd15a
commit a539320135
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,14 @@
import { interpolatePath } from 'd3-interpolate-path';
// $ExpectType (t: number) => string
const interpolate = interpolatePath('M0,0 L10,10', 'M10,10 L20,20 L30,30');
// $ExpectType string
interpolate(0.6);
// $ExpectType string
interpolatePath(
'M0,0 L10,10',
'M10,10 L20,20 L30,30',
(a, b) => a.x === b.x && b.y === 30 && a.type === 'L'
)(0.3);

16
types/d3-interpolate-path/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
// Type definitions for d3-interpolate-path 2.0
// Project: https://github.com/pbeshai/d3-interpolate-path
// Definitions by: Paweł Dąbrowski <https://github.com/paolostyle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface PathCommandObject {
type: string;
x: number;
y: number;
}
export function interpolatePath(
a: string,
b: string,
excludeSegment?: (a: PathCommandObject, b: PathCommandObject) => boolean
): (t: number) => string;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"d3-interpolate-path-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }