microsoft / microsoft/TypeScript
Find All References should include composed return value
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔍 Search Terms
"Find all References", "find references composable", "find all references returned"
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Running 'Find all references' on a Function defined within a function and returned in a composed object, should include references to the function defined on the composed object.
📃 Motivating Example
It's a common practice to compose objects within functions that are exported for use by the program.
For example, using object composition with pinia and vue:
import { defineStore } from "pinia";
export const useMyStore = defineStore('mystore', () => {
function funcA() { }
return {
funcA,
}
});
However, using 'findAllReferences' on the function defined within the composing function does not detect references through the returned object:
Using 'findAllReferences' on the function defined on the returned object itself, does return such references:
💻 Use Cases
- When editing a function in a composed store, it is common to check for references to the function being changed.
- The references of the function defined within the composable function only returns the references within the store, rather than uses linked by the composed object.
- Currently you must scroll from the function being worked on to the composed object, and run 'Find All References' from there. It is a minor inconvenience, but an extremely common one.
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
Reproduce the composed-object example and compare Find All References results for the inner function and the returned property. Start at the Find All References language-service entry point, then identify the relevant reference tests; done means references through the composed return value are included without changing runtime behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100