Why play locally?
While the TypeScript Playground is great for quick practice, playing locally gives you:- Full IDE support - IntelliSense, go-to-definition, and all your favorite editor features
- Git integration - Track your progress and solutions
- Offline access - Work on challenges anywhere
- Custom setup - Use your preferred TypeScript configuration and tools
Prerequisites
You’ll need the following installed on your machine:Node.js
Latest LTS version recommendedDownload Node.js
pnpm
Fast, disk space efficient package managerInstall pnpm
Type Challenges uses
pnpm as the package manager. While you could use npm or yarn, we recommend using pnpm as specified in the project.Installation
Install dependencies
Install all required dependencies using pnpm:This will install:
- TypeScript compiler and type utilities
- Build scripts and tooling
- Development dependencies
Generate the playground
Run the generate script to create a local playground:The script will prompt you to select your preferred language:
- English
- 简体中文 (Simplified Chinese)
- 日本語 (Japanese)
- 한국어 (Korean)
- Português (Portuguese)
./playground folder.Playground structure
After generation, your playground folder will look like this:- The challenge description
- Template code to modify
- Test cases that must pass
Working on challenges
Here’s the typical workflow:Updating the playground
If new challenges are added to the repository, you can update your playground while keeping your solutions:- Add new challenges
- Keep your existing solutions
- Update challenge descriptions if they’ve changed
IDE recommendations
VS Code
VS Code has excellent TypeScript support out of the box. Consider these extensions:- Type Challenges Extension - Browse and solve challenges directly in VS Code
- Install from VS Code Marketplace
- Error Lens - Show TypeScript errors inline
- Pretty TypeScript Errors - More readable error messages
Other IDEs
Any IDE with TypeScript language support will work:- WebStorm - Full TypeScript support built-in
- Neovim - Use with
typescript-language-server - Emacs - Use with
tideor LSP mode - Sublime Text - Use with LSP-typescript
Tips for local development
Track your progress with Git
Track your progress with Git
Create a new branch for your solutions:This lets you:
- Track which challenges you’ve completed
- Keep a history of different approaches
- Share your solutions on GitHub
Use TypeScript's strict mode
Use TypeScript's strict mode
All challenges assume TypeScript’s strict mode is enabled. This is already configured in the project’s
tsconfig.json.If you’re setting up a custom configuration, ensure:Understand the test utilities
Understand the test utilities
Type Challenges uses utility types from
@type-challenges/utils:Expect<T>- Asserts that T is trueEqual<A, B>- Checks if A and B are the same typeNotEqual<A, B>- Checks if A and B are different typesNotAny<T>- Ensures T is not the any type
Compare with built-in types
Compare with built-in types
For challenges that ask you to implement built-in utilities (like Pick, Omit, Readonly), compare your solution with TypeScript’s implementation:You can Cmd/Ctrl+Click on built-in types to see their definitions.
Troubleshooting
pnpm install fails
pnpm install fails
Make sure you have the correct Node.js version:If you’re using an older version, update Node.js or use a version manager like
nvm:IDE not showing TypeScript errors
IDE not showing TypeScript errors
- Ensure your IDE’s TypeScript version matches the project’s
- Try reloading the TypeScript server
- Check that you opened the
playgroundfolder (not the root repository)
Generated playground is empty
Generated playground is empty
Make sure you ran If issues persist, try clearing and reinstalling:
pnpm install before pnpm generate:Next steps
Start solving
Begin with the warm-up challenge and work your way up
Join the community
Get help and discuss solutions with other developers