mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-04 07:52:51 +00:00
Added typing for abs-svg-path (#43807)
* Implemented abs-svg-path typings * Fixed abs path test * Fixed ExpectType
This commit is contained in:
parent
6ec9e84831
commit
539042117c
2
types/abs-svg-path/abs-svg-path-tests.ts
Normal file
2
types/abs-svg-path/abs-svg-path-tests.ts
Normal file
@ -0,0 +1,2 @@
|
||||
import abs = require('abs-svg-path');
|
||||
const absolutized = abs([['M', 10, 10], ['l', 100, 100]]); // $ExpectType AbsAnyCommand[]
|
||||
43
types/abs-svg-path/index.d.ts
vendored
Normal file
43
types/abs-svg-path/index.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// Type definitions for abs-svg-path 0.1
|
||||
// Project: https://github.com/jkroso/abs-svg-path
|
||||
// Definitions by: Liam Martens <https://github.com/LiamMartens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type RelMoveCommand = ['m', number, number];
|
||||
type AbsMoveCommand = ['M', number, number];
|
||||
type MoveCommand = RelMoveCommand | AbsMoveCommand;
|
||||
type RelLineCommand = ['l', number, number];
|
||||
type AbsLineCommand = ['L', number, number];
|
||||
type LineCommand = RelLineCommand | AbsLineCommand;
|
||||
type RelHorizontalCommand = ['h', number];
|
||||
type AbsHorizontalCommand = ['H', number];
|
||||
type HorizontalCommand = RelHorizontalCommand | AbsHorizontalCommand;
|
||||
type RelVerticalCommand = ['v', number];
|
||||
type AbsVerticalCommand = ['V', number];
|
||||
type VerticalCommand = RelVerticalCommand | AbsVerticalCommand;
|
||||
type RelClosePathCommand = ['z'];
|
||||
type AbsClosePathCommand = ['Z'];
|
||||
type ClosePathCommand = RelClosePathCommand | AbsClosePathCommand;
|
||||
type RelBezierCurveCommand = ['c', number, number, number, number, number, number];
|
||||
type AbsBezierCurveCommand = ['C', number, number, number, number, number, number];
|
||||
type BezierCurveCommand = RelBezierCurveCommand | AbsBezierCurveCommand;
|
||||
type RelFollowingBezierCurveCommand = ['s', number, number, number, number];
|
||||
type AbsFollowingBezierCurveCommand = ['S', number, number, number, number];
|
||||
type FollowingBezierCurveCommand = RelFollowingBezierCurveCommand | AbsFollowingBezierCurveCommand;
|
||||
type RelQuadraticCurveCommand = ['q', number, number, number, number];
|
||||
type AbsQuadraticCurveCommand = ['Q', number, number, number, number];
|
||||
type QuadraticCurveCommand = RelQuadraticCurveCommand | AbsQuadraticCurveCommand;
|
||||
type RelFollowingQuadraticCurveCommand = ['t', number, number];
|
||||
type AbsFollowingQuadraticCurveCommand = ['T', number, number];
|
||||
type FollowingQuadraticCurveCommand = RelFollowingQuadraticCurveCommand | AbsFollowingQuadraticCurveCommand;
|
||||
type RelArcCommand = ['a', number, number, number, number, number, number, number];
|
||||
type AbsArcCommand = ['A', number, number, number, number, number, number, number];
|
||||
type ArcCommand = RelArcCommand | AbsArcCommand;
|
||||
type AnyCommand = MoveCommand | LineCommand | HorizontalCommand | VerticalCommand |
|
||||
ClosePathCommand | BezierCurveCommand | FollowingBezierCurveCommand |
|
||||
QuadraticCurveCommand | FollowingQuadraticCurveCommand | ArcCommand;
|
||||
type AbsAnyCommand = AbsMoveCommand | AbsLineCommand | AbsHorizontalCommand | AbsVerticalCommand |
|
||||
AbsClosePathCommand | AbsBezierCurveCommand | AbsFollowingBezierCurveCommand |
|
||||
AbsQuadraticCurveCommand | AbsFollowingQuadraticCurveCommand | AbsArcCommand;
|
||||
declare function absolutize(path: AnyCommand[]): AbsAnyCommand[];
|
||||
export = absolutize;
|
||||
23
types/abs-svg-path/tsconfig.json
Normal file
23
types/abs-svg-path/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"abs-svg-path-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/abs-svg-path/tslint.json
Normal file
1
types/abs-svg-path/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user