Skip to content

Idea: Infer types / parameters from runtime (V8 debugger/inspector protocol) #19641

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

Closed
niieani opened this issue Nov 1, 2017 · 3 comments
Closed
Labels
Community Tooling This might be better handled by tooling from the community instead of built into TypeScript Suggestion An idea for TypeScript

Comments

@niieani
Copy link

niieani commented Nov 1, 2017

Given the new "infer parameters from usage" functionality, it would seem doable to do something similar like "infer parameters from runtime/debugger", especially in environments like VSCode, which tightly integrate a debugger.

In runtime you get most of the information to generate pretty good types, at least for a start, so... why not? This would be a massive help in migrating JavaScript to TypeScript.

Also, V8 has just recently introduced takeTypeProfile to the inspector protocol, that could be used to leverage just that. There's an example usage here: https://github.com/fhinkel/type-profile.

@ghost
Copy link

ghost commented Nov 1, 2017

https://github.com/Microsoft/dts-gen attempts to do something like this, although it doesn't integrate with the editor.

@ghost ghost added the Suggestion An idea for TypeScript label Nov 1, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Nov 1, 2017

You can implement some of these features in a language service plugin today. would love to see someone experiment with that.

@mhegazy mhegazy added the Community Tooling This might be better handled by tooling from the community instead of built into TypeScript label Nov 1, 2017
@weswigham
Copy link
Member

dts-gen's functionality is now integrated into the compiler with #26588, so I think we've done this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Tooling This might be better handled by tooling from the community instead of built into TypeScript Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants