Skip to content

Commit 9e9c947

Browse files
committed
fix(vector): reduce double code in jsdocs
1 parent d528042 commit 9e9c947

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/point.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ function square(val) {
4444
}
4545

4646
/**
47+
* @typedef {() => number} Alg
4748
* @typedef {APoint & number} APointType
4849
* @abstract
4950
*/
5051
class APoint {
5152
/**
52-
* @param {number | (() => number)} x
53+
* @param {number | (Alg)} x
5354
* @param {number} [y]
5455
*/
5556
constructor(x, y) {
@@ -320,15 +321,14 @@ export class IPoint extends APoint {
320321
}
321322

322323
/**
323-
* @param {() => number} alg
324+
* @param {Alg} alg
324325
* @return {PointType | IPointType}
325326
*/
326327
export function calc(alg) {
327328
return operatorCalc(alg);
328329
}
329330

330331
/**
331-
* @typedef {() => number} Alg
332332
* @typedef {(alg: Alg) => PointType} PointAlg
333333
* @typedef {(x: number , y: number) => PointType} PointCon
334334
* @typedef {PointAlg & PointCon} point
@@ -340,13 +340,10 @@ export const point = function point(x, y) {
340340
};
341341

342342
/**
343-
* @typedef {() => number} Alg
344343
* @typedef {(alg: Alg) => IPointType} IPointAlg
345344
* @typedef {(x: number , y: number) => IPointType} IPointCon
346345
* @typedef {IPointAlg & IPointCon} ipoint
347346
*
348-
* @param {number} x
349-
* @param {number} y
350347
* @type {ipoint}
351348
*/
352349
export const ipoint = function ipoint(x, y) {

src/vector.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ function square(val) {
2020
}
2121

2222
/**
23+
* @typedef {() => number} Alg
2324
* @typedef {AVector & number} AVectorType
2425
* @abstract
2526
*/
2627
class AVector {
2728
/**
28-
* @param {number | (() => number)} x
29+
* @param {number | (Alg)} x
2930
* @param {number} [y]
3031
* @param {number} [z]
3132
* @returns {AVectorType}
@@ -393,15 +394,14 @@ export class Victor extends AVector {
393394
}
394395

395396
/**
396-
* @param {() => number} alg
397+
* @param {Alg} alg
397398
* @return {VectorType | VictorType}
398399
*/
399400
export function calc(alg) {
400401
return operatorCalc(alg);
401402
}
402403

403404
/**
404-
* @typedef {() => number} Alg
405405
* @typedef {(alg: Alg) => VectorType} VectorAlg
406406
* @typedef {(x: number , y: number, z: number) => VectorType} VectorCon
407407
* @typedef {VectorAlg & VectorCon} vector
@@ -413,7 +413,6 @@ export const vector = function vector(x, y, z) {
413413
};
414414

415415
/**
416-
* @typedef {() => number} Alg
417416
* @typedef {(alg: Alg) => VictorType} VictorAlg
418417
* @typedef {(x: number , y: number, z: number) => VictorType} VictorCon
419418
* @typedef {VictorAlg & VictorCon} victor

0 commit comments

Comments
 (0)