Skip to content

Commit 96428cb

Browse files
committed
fix(): better types
1 parent 18b82b4 commit 96428cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

intersect.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export declare function parsePathCurve(path: Path): PathComponent[]
5959
* ]
6060
*/
6161
declare type Path = string | PathComponent[];
62-
declare type PathComponent = [cmd: string, ...number[]];
62+
declare type RelativePathCmd = 'a' | 'c' | 'h' | 'l' | 'm' | 'q' | 's' | 't' | 'v' | 'z';
63+
declare type AbsolutePathCmd = Capitalize<RelativePathCmd>;
64+
declare type PathComponent = [cmd: AbsolutePathCmd | RelativePathCmd, ...number[]];
6365

6466
declare interface Intersection {
6567
/**

test/intersect.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ describe('path-intersection', function() {
55

66
describe('api', function() {
77

8-
const p1: Path = [ [ 'M', 0, 0 ], [ 'L', 100, 100 ] ];
9-
const p2: Path = 'M0,100L100,0';
8+
const p1: Path = [ [ 'M', 0, 0 ], [ 'L', 100, 100 ] ] satisfies Path;
9+
const p2: Path = 'M0,100L100,0' satisfies Path;
1010

1111

1212
it('should support SVG path and component args', function() {

0 commit comments

Comments
 (0)