

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Install TypeScript
incomplete
2: tsconfig.json
incomplete
3: More tsconfig.json
incomplete
4: Declaration Files
incomplete
5: Using JS Libraries
incomplete
6: TypeScript Language Server
incomplete
7: TypeScript Ignore
incomplete
8: Vanilla Vite
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We've used tsc from the command line to compile our TypeScript code, but that's often not how it's used in practice... at least not directly. In many projects, TypeScript is primarily used as a language server to provide type checking and other features in your IDE. It powers stuff like:
Auto-completion
Type checking (showing and underlining errors in your editor)
Jumping to definitions
That's why we sometimes joke about TypeScript being a "glorified linter". There are a few reasons I point out this distinction, but the first is to understand that your editor tooling and your build tooling are separate. If your editor is using TypeScript 4 and one tsconfig.json file, but your build tooling is using TypeScript 5 and another tsconfig.json file, you can run into scenarios where your editor and what's being compiled in production are out of sync.
All this to say... keep them in sync! Most editors are smart at this and do it automatically, but it's worth knowing how to check what your editor is using under the hood.
Most editors will default to using the version of TypeScript installed in your project. If you have a node_modules folder, it will use that version.
If you don't, or you don't have your editor opened to the right project directory, it will likely use:
The version of TypeScript installed globally on your machine
The version of TypeScript bundled in the editor itself
The version of TypeScript specified in your editor settings (e.g. .vscode/settings.json, .zed/settings.json, etc.)
Pin the version of TypeScript in your project to avoid this confusion, and make sure your editor is using that version.
Language servers are notorious for kinda just... getting stuck. If you notice that your editor is not picking up on type errors, or is not providing auto-completion, step #1 should probably be to restart the TypeScript language server.
In VS Code: Cmd/Ctrl+Shift+P > TypeScript: Restart TS Server
In Zed: Cmd/Ctrl+Shift+P > Restart Language Server
In Neovim: :lsp restart (or :LspRestart)
Let's pin the version of TypeScript used in our moonshot proof of concept AI Support site.
npm i -D typescriptNotice that this adds the TypeScript version to your package.json file.
Run and submit the CLI tests.