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

Question on undocumented API #8367

Closed
hriss95 opened this issue Sep 1, 2016 · 9 comments
Closed

Question on undocumented API #8367

hriss95 opened this issue Sep 1, 2016 · 9 comments
Labels
querystring Issues and PRs related to the built-in querystring module. question Issues that look for answers. vm Issues and PRs related to the vm subsystem.

Comments

@hriss95
Copy link

hriss95 commented Sep 1, 2016

Hello, I am trying to help with keeping node.d.ts up to date in DefinitelyTyped (Using node's API in TypeScript).

There was a recent discussion on what part of the API exactly should be documented as only what is intended for public use is the current logic behind DefinitelyTyped's way of introducing definitions. That said, I've encountered on numerous occasions that there are functions that are available to me(for example could be seen by running node and display the exports object for a given module using require() ) and are not present in the documentation or at least not in the current one. There were 2 recent cases on DefinitelyTyped. One was involving "querystring" and its unescapeBuffer function which could be seen after running require("querystring") - there is no documentation for it, but it could still be used in no different way than the others. The other case was concerning the "vm" module and it's createScript function which actually has documentation but in older versions of node like this.

So, my question is whether these 2 (and any other similar cases that might be found) are meant for public use. Currently, due to the nature of TypeScript and the fact that they are not present in the documentation, these 2 functions mentioned cannot be used by TypeScript users that rely on DefinitelyTyped's definitions for node. Since DefinitelyTyped is the repository which most of the users get their definitions from I created a pull request there adding these and got an answer that I should create an issue here on whether these are public or not. Thank you in advance for the help!

@mscdex mscdex added the question Issues that look for answers. label Sep 1, 2016
@mscdex
Copy link
Contributor

mscdex commented Sep 1, 2016

IMHO anything that's undocumented (and accessible) is "use at your own risk." It could go away or change at any time and is not supported.

@hriss95
Copy link
Author

hriss95 commented Sep 1, 2016

That seems reasonable. However, the question was more about the fact that TypeScript can allow or disallow the usage of such functions simply by including/excluding them from the definition file for node. So, I guess, the question is whether TypeScript users who want to use node should be allowed to use them or not(since TypeScript can actually enforce that)

@addaleax addaleax added querystring Issues and PRs related to the built-in querystring module. vm Issues and PRs related to the vm subsystem. labels Sep 1, 2016
@mscdex
Copy link
Contributor

mscdex commented Sep 1, 2016

I don't think this is something that should be decided by node core, but rather by the TypeScript folks and/or their end users.

@cjihrig
Copy link
Contributor

cjihrig commented Sep 1, 2016

Just my personal opinion, but if you can prevent your users from accessing undocumented APIs, it will probably save them headaches somewhere down the line. They mostly only exist because in the past, core didn't have a way to make things internal only.

Either way, I'm going to close this, as there is nothing for us to do here. Feel free to keep the discussion going.

@cjihrig cjihrig closed this as completed Sep 1, 2016
@hriss95
Copy link
Author

hriss95 commented Sep 1, 2016

Thank you for the response. I guess it does sound reasonable that you should probably not be able to use undocumented stuff that can be changed or removed.

@ChALkeR
Copy link
Member

ChALkeR commented Sep 1, 2016

Perhaps we should deprecate or document unescapeBuffer?

@watilde
Copy link
Member

watilde commented Feb 25, 2017

I also just came up with the same things for qs. unescapeBuffer and qs.decode. I think it's better to mention them in the docs as use at your own risk if it's so.

@sam-github
Copy link
Contributor

We can document them as doc-only deprecated, then start the deprecation train (hard deprecation, removal into internal where they cannot be used by users).

@joyeecheung
Copy link
Member

I think somewhere @mscdex mentioned starting to document qs.unescapeBuffer would be better because it is actually useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
querystring Issues and PRs related to the built-in querystring module. question Issues that look for answers. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

No branches or pull requests

8 participants