microsoft / microsoft/TypeScript
Add refactoring action to annotate a variable or a function signature component with its inferred type
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Hi, I'm using latest stable VSCode / latest nightly TS and I'm not sure if codefixes and refactorings have been implemented there yet, in any case, having a refactoring option to take any variable which receives an implicit inferred type, say, through a function call:
function test(): number[] {
// ...
}
let x = test();
And being able to right-click x and invoke an action like Annotate with inferred type (or Extract inferred type), such that the resulting statement would look like:
let x: number[] = test();
could be very useful!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TypeScript codefix and refactoring behavior used by VSCode, reproducing the example with the latest nightly TypeScript. Define how the action should handle inferred variable types and function-signature components, then verify that it produces annotations such as let x: number[] = test();.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100