IDE TypeScript Version Selection
What you'll learn: How to make your editor use the correct TypeScript version for your project instead of a mismatched global or built-in version.
Why This Matters
Your code editor (like VS Code) often comes with its own bundled TypeScript version for IntelliSense and error checking. However, your project might use a different version installed locally. If these don't match, you'll see confusing behavior: errors in your editor that don't appear when you run tsc, or vice versa.
Think of it like having two different dictionaries—one on your desk (the editor's version) and one in your backpack (your project's version). If they define words differently, you'll get conflicting information!
Configuring Your Editor
Most modern editors let you choose which TypeScript version to use for language features. In VS Code:
- Open any TypeScript file in your project
- Look at the bottom-right of the status bar—you'll see something like "TypeScript 5.3.3"
- Click that version number
- Select "Use Workspace Version" from the menu
This tells your editor: "Use the TypeScript installed in my project's node_modules, not your built-in version."
Why Workspace Version Wins
Your project's package.json specifies an exact TypeScript version that you've tested with. Using the workspace version ensures:
- Consistent error messages between your editor and command line
- Features match what your team uses
- No surprise breakages when your editor updates
Key Takeaway: Always configure your editor to use your project's workspace TypeScript version to ensure consistency between what you see in your editor and what happens when you run tsc.