microsoft / microsoft/TypeScript
TypeScript refactoring: option to use `export default` with "Move to a new file"
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Among other reasons, I'd like to avoid barrel files and I find that default exports make doing so more intuitive (named exports are easily spread into a barrel file while default exports not so much).
Some files like default exports and some folks do not. I get that.
Unless there's a need to do so, I'd like VSCode to make it just as easy to use default exports as named exports. Today, TypeScript refactoring with Visual Studio Code favors named exports. This default behavior may provide some encouragement/bias to use them and not use default exports as much.
There is also a "Convert between default export and named export" refactoring which is handy but requires another step and an aware/intentional decision to use default exports.
Can "Move to a new file" be split into two options or otherwise support prompting developers to explicitly select which type of export to use while they are refactoring?
e.g.
- "Move to a new file as default export"
- "Move to a new file as named export"
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
Read the linked TypeScript refactoring documentation and start from the “Move to a new file” refactoring described in the issue. Define the scope for offering explicit default-export and named-export choices; done means users can select either export style during that refactoring.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100