React, etc. Tech Stack

React, Flux, GraphQL, Hack, HHVM...? All of this and more!

File rename refactoring coming to TypeScript

TypeScript often though of being just a type system for JavaScript, similar to Flow. But the reality is that the language features are only part of the picture. The tooling for refactoring, etc. where it's at.

One feature users working with Visual Studio and C#, or some of the JetBrains editors such as WebStorm or PhpStorm, is refactoring when renaming. This may seem like an glaring omission, but the TypeScript tooling infrastructure simply has not had that capability.

But this is changing, with the TypeScript editor language services being extended to support file renaming refactoring. The effort were started a few weeks ago, and now there is a pull request (#23573) with the feature in place. The high level implementation is as follows:

User renames a file using explorer in editor (with TS integration)

Tsserver process will pick up change, update the project

After rename, editor will prompt user to update references to renamed file

If user agrees, the tsserver process will update all known references to file

The feature is not yet merged, or scheduled for any specific release. However, once it is in the master branch users who want to test the functionality can simply use the bleeding edge nightly version.

File renaming is another small feature that will make working with large JavaScript / TypeScript applications easier in both browser and server applications using Node.js. Any editor supporting the standard TypeScript language services, will be able to integrate the feature in to use.