Skip to content

Commit ecfef2a

Browse files
committed
chore: improve types
1 parent 7dd8eb5 commit ecfef2a

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"typescript": "^4.9.3"
3131
},
3232
"dependencies": {
33-
"expression-globals-typescript": "^3.1.3"
33+
"expression-globals-typescript": "^3.2.6"
3434
}
3535
}

src/index.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { Layer, PathProperty } from 'expression-globals-typescript';
1+
import {
2+
Layer,
3+
PathProperty,
4+
Points,
5+
Vector2D,
6+
} from 'expression-globals-typescript';
27

38
// Creating layer and property mocks
49
const thisLayer = new Layer();
@@ -7,8 +12,6 @@ const thisProperty = new PathProperty([[0, 0]]);
712
// eBox types
813
type Anchor = 'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft' | 'center';
914
type Rounding = [number, number, number, number];
10-
type Vector2D = [number, number];
11-
type Points = Array<Vector2D>;
1215

1316
interface BoxProps {
1417
size: Vector2D;
@@ -121,7 +124,7 @@ function createBox({
121124
thisLayer.add(pBl, [0, -rBl]),
122125
];
123126

124-
const inTangents = [
127+
const inTangents = ([
125128
// Top left
126129
[0, 0],
127130
[-rTl, 0],
@@ -134,8 +137,9 @@ function createBox({
134137
// Bottom left
135138
[0, 0],
136139
[0, rBl],
137-
].map(p => thisLayer.mul(p, tangentMult));
138-
const outTangents = [
140+
] as Vector2D[]).map(p => thisLayer.mul(p, tangentMult));
141+
142+
const outTangents = ([
139143
// Top left
140144
[0, -rTl],
141145
[0, 0],
@@ -148,7 +152,7 @@ function createBox({
148152
// Bottom left
149153
[-rBl, 0],
150154
[0, 0],
151-
].map(p => thisLayer.mul(p, tangentMult));
155+
] as Vector2D[]).map(p => thisLayer.mul(p, tangentMult));
152156

153157
return thisProperty.createPath(
154158
cornerPoints,

0 commit comments

Comments
 (0)