Skip to content
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

[math] Documentation is misleading for function parameters #409

Open
jffaust opened this issue Sep 1, 2023 · 1 comment
Open

[math] Documentation is misleading for function parameters #409

jffaust opened this issue Sep 1, 2023 · 1 comment

Comments

@jffaust
Copy link
Contributor

jffaust commented Sep 1, 2023

I was looking to use the fit function from the math package. I looked at the documentation to understand how to use it.

image

The parameters of the function in the documentation are: a, b, c, d, e

And the documentation states that "Returns a number in the [c,d] interval which is relative to x in the [a,b] interval". I found it a bit weird that it specified the x parameter but all the others were valid so I thought the e parameter must be x.

I was getting really weird behavior in my code so I looked up the code of the function and x is actually the first parameter :O

This must be because of the Fn5 type used under the hood.

Taking a closer look at the help in my editor, I can see the the first parameter is x (@param x) but it's still quite confusing and impossible to know from the documentation site:

image

@postspectacular
Copy link
Member

This is really an (unresolved) issue with arrow functions, predeclared function types and how they're handled by TypeDoc and/or the TypeScript language server in general (tl;dr like 3rd class citizens). Also see #385 and #362 for related aspects... The only way around this seems to be a) replacing all arrow function with "normal" functions or b) removing the usage of function types and adding type info to each arg. Both are non-desirable/non-beneficial changes. My recommendation is to file some related issues with either TypeDoc and/or TypeScript... I personally don't have the bandwidth to deal with this, but would be grateful to anyone who does...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants