简体   繁体   中英

Is there a VSCode extension that adds a Quick Fix for adding the explicit type to a field for Typescript?

I want to have a Quick Fix action ( cmd +. ) that adds the explicit type to a field, parameter, or function return (where it is otherwise inferred).

To turn

const specificQuesiton = await Question.query().findById(1)

into

const specificQuesiton: Question = await Question.query().findById(1)

Found one!

https://marketplace.visualstudio.com/items?itemName=nick-lvov-dev.typescript-explicit-types

Here's an example of it in action: 在此处输入图像描述

I also found this one which just does return type (the one above does everything).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM