-
-
Notifications
You must be signed in to change notification settings - Fork 952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: specify type #1795
fix: specify type #1795
Conversation
Thanks for the PR request. The text changes look good. |
Understand. |
Well, it may be still good to have some changes, like to check why x and y are |
OK. Exampe static getPointOnCubicBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y, P4x, P4y) {
function CB1(t: number) { // <- argument type
return t * t * t;
}
function CB2(t: number) { // <- argument type
return 3 * t * t * (1 - t);
}
function CB3(t: number) { // <- argument type
return 3 * t * (1 - t) * (1 - t);
}
function CB4(t: number) { // <- argument type
return (1 - t) * (1 - t) * (1 - t);
}
var x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);
var y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);
return {
x: x, // number
y: y, // number
};
} Path.d.tsPath.getPointOnCubicBezier(pct: any, P1x: any, P1y: any, P2x: any, P2y: any, P3x: any, P3y: any, P4x: any, P4y: any): {
x: number;
y: number;
} To usePath.getPointOnCubicBezier('0', '0', '0', '0', '0', '0', '0', '0', '0');
Path.getPointOnCubicBezier(0, 0, 0, 0, 0, 0, 0, 0, 0); |
Well, as I can see, the type of As I can see |
Yeah, youre right To modify the three functions (return
If there is a better way, please let me know. static getPointOnLine(
dist: number,
P1x: number,
P1y: number,
P2x: number,
P2y: number,
fromX?: number,
fromY?: number
) { ... } |
This is the way. Also, some functions may need additional types inside their body. |
Thanks |
Hello 😄
Is there a reason for not specifying the type for the following changes?
I changed it to use it more accurately.
Thx.
Path
Before
After
Text
Before
After