This extension is available on the VSCode Marketplace.
I made this because the other available extensions which convert JS to TS either required you to use a JSON object or they created a separate TS file. This extension does not require you to use JSON and captures the TS type in your clipboard so that you can paste it anywhere you want.
- Highlight a JS Object, and get a TypeScript interface in your clipboard
- VS Code 1.44 or higher
- Highlight your JS object
- Open command pallette (
Ctrl/Cmd-Shift-P
) - Search for "Make JS Object into TS Type: clipboard"
- Select option
- TS type is now in your clipboard, now paste it wherever you want to