Skip to content

add codefix for extracting an interface from an object literal #13082

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

Open
zpdDG4gta8XKpMCd opened this issue Dec 21, 2016 · 2 comments
Open
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Domain: Refactorings e.g. extract to constant or function, rename symbol Suggestion An idea for TypeScript

Comments

@zpdDG4gta8XKpMCd
Copy link

given an anonimous object literal, allow extracting interface by looking at the effective types of the values of the properties

@mhegazy mhegazy added Domain: Refactorings e.g. extract to constant or function, rename symbol Suggestion An idea for TypeScript labels Dec 21, 2016
@basarat
Copy link
Contributor

basarat commented Dec 31, 2016

I've used json2dts in the past e.g in alm.tools

But I too would like something better that's language service driven ❤️

Quick question: Can you write code before, trigger point, code after. I imagine a Add type annotation would be really useful:

// before
const foo = {hello:'world'};
//       ^  trigger anywhere in variable name "Add type annotation"

// after
const foo:{hello: string} = {hello:'world'};

🌹

@DanielRosenwasser
Copy link
Member

@basarat sounds like you might want #13199.

@RyanCavanaugh RyanCavanaugh added the Experience Enhancement Noncontroversial enhancements label Aug 13, 2018
@RyanCavanaugh RyanCavanaugh added this to the Future milestone Aug 13, 2018
@weswigham weswigham added the In Discussion Not yet reached consensus label Nov 6, 2018
@RyanCavanaugh RyanCavanaugh removed this from the Backlog milestone Jul 26, 2019
@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature and removed Experience Enhancement Noncontroversial enhancements In Discussion Not yet reached consensus labels Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Domain: Refactorings e.g. extract to constant or function, rename symbol Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants