-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Type descriptions for documentation of JavaScript APIs #14348
Comments
Ideally, just configure your editor/language-server so it can pick those up automatically. There is little reason to generate |
A lot of editors and tooling will specifically look for .d.ts files to determine if types are correct, they can't do this from the JavaScript or type comments directly (at least, that's my understanding, I am certainly no JavaScript expert, and I'm sure some use the comments too). In my case I don't use an IDE, but found reading the .d.ts files for the various APIs much easier than having to scroll through the entire implementation to figure out what's going on and still not have the auto-generated types themselves (and the type checker I use wants a .d.ts file). |
I agree that its easier to read a |
Some editors can, but like I said, some like .d.ts files instead or can at least get more accurate type information from them (ie. they pull the function signature as |
right. Well I don't personally see a huge amount of value of shipping extra files that just duplicate/summarize existing info. Even if those file are autogenerated, keeping those in sync requires adding yet another tool. Usually the corresponding wiki page is supposed to serve as the best and most complete documentation as it also carries some additional explanatory value over just plain function signatures... So if you're prefer reading |
Yah, I auto-generated some for now, but it was a pain to setup. If they just already exist alongside the javascript files they would have just been picked up automatically. My last pitch is that it could potentially help catch bugs when the javascript files are changed (ie. if you generate the file it would be more obvious if something looks funny, or the generator can catch some problems at "compile"-time that wouldn't be apparent in the javascript until build time, etc.). But I understand that it's more maintenance overhead and may not be something people want to deal with. Thanks again for your consideration. |
Feature Description
I'd like to request that type description files (
.d.ts
), like those used to document the internal JavaScript APIs (see eg.midi-controller-api.d.ts
andengine-api.d.ts
) also be included for the various JavaScript files in theres/controllers/
tree.These can be automatically generated from the JavaScript files, or they can be hand written. Writing them by hand would of course require more work, and require keeping them up to date, so it may not be something the maintainers want to do. Having them be auto generated by
tsc(1)
ordts-gen(1)
could be handled as a pre-commit hook, in CI, or similar and would be faster, but you'd lose some of their ability to document the JavaScript (ie. the "options" type that's passed to various constructors inmidi-components-0.0.js
would not have a list of acceptable options, instead it would just be an arbitrary object,any
). However, even automatically generated bindings would be extremely helpful for documenting the API, and they could be improved over time with type comments (which are already available for some functions). It's possible there are ways to specify more specific object types later as well, but for a first pass just having something in the directory next to the corresponding JavaScript file would make things much easier to read/figure out when writing a controller for the first time, I think.Thank you for your consideration, I'm loving using Mixxx so far!
The text was updated successfully, but these errors were encountered: