Documentation Index
Fetch the complete documentation index at: https://mintlify.com/typescript-exercises/typescript-exercises/llms.txt
Use this file to discover all available pages before exploring further.
Contribution Guidelines
This guide covers the coding standards, best practices, and processes for contributing to TypeScript Exercises.Code Style
The project enforces consistent code style through ESLint and Prettier configurations.ESLint Configuration
The project uses a comprehensive ESLint setup:ESLint Extends
ESLint Extends
Key TypeScript Rules
Key TypeScript Rules
- @typescript-eslint/no-explicit-any:
warn- Avoid usinganytype - @typescript-eslint/consistent-type-definitions: Use
interfaceovertype - @typescript-eslint/no-unused-vars: Warn about unused variables (except those prefixed with
_) - @typescript-eslint/no-use-before-define: Error, but allows functions and classes
Import Rules
Import Rules
- import/no-relative-parent-imports: Error - No
../imports - import/order: Alphabetically ordered imports in groups (builtin, external, internal, sibling)
- no-duplicate-imports: Error - No duplicate import statements
React Rules
React Rules
- react/jsx-curly-brace-presence: Use curly braces only when necessary
- react/jsx-boolean-value: Always explicit boolean values
- react/prop-types: Off (using TypeScript instead)
Prettier Configuration
The project uses Prettier for consistent formatting:.prettierrc
Prettier is integrated with ESLint through
prettier/prettier rule with singleQuote: true.Running Code Quality Checks
Creating New Exercises
When creating a new exercise, follow this structure:Exercise Design Principles
Progressive Difficulty
Each exercise should be slightly harder than the previous one
Single Concept Focus
Teach one main TypeScript concept per exercise
Real-World Context
Use realistic scenarios and data structures
Clear Instructions
Provide context, goals, and hints in comments
Exercise Categories
Exercises should align with one of these categories:- Basic typing (Exercises 1-3) - Interfaces, types, basic objects
- Refining types (Exercises 4-5) - Type guards, narrowing
- Union types (Exercises 6-7) - Discriminated unions, type unions
- Merged types (Exercises 8-9) - Intersection types
- Generics (Exercises 10-11) - Generic functions and types
- Type declarations (Exercises 12-13) -
.d.tsfiles for JS libraries - Module augmentation (Exercises 14-15) - Extending module types
- Advanced type mapping (Exercises 16+) - Conditional types, mapped types
The Golden Rule: No any Type
This is the #1 principle of TypeScript Exercises. Solutions should demonstrate proper TypeScript usage:
@typescript-eslint/no-explicit-any rule is set to warn to help catch this.
Pull Request Process
When you’re ready to submit your contribution:Create a Feature Branch
feature/exercise-[number]-[concept]fix/exercise-[number]-[issue]docs/[description]
Make Your Changes
- Write your code following the style guidelines
- Run
yarn lint-fixto auto-fix formatting issues - Test your changes with
yarn start
Commit Your Changes
Write clear, descriptive commit messages:
The pre-commit hook will automatically run linting. Fix any errors before the commit succeeds.
Push and Create PR
- Clear title describing the change
- Description of what the change does
- Any relevant context or testing notes
Testing Your Changes
Manual Testing
Manual Testing
- Start the development server:
yarn start - Navigate to your new/modified exercise
- Verify the exercise displays correctly
- Check that type errors appear as expected
- Test that the solution resolves all errors
Lint Testing
Lint Testing
Build Testing
Build Testing
Documentation Standards
When documenting exercises:Clear Explanations
Explain the “why” not just the “what”
Code Examples
Show both incorrect and correct approaches
External Links
Link to official TypeScript documentation
Hints
Provide hints at the bottom for stuck learners
Comment Structure
Use this template for exercise files:Code Review Guidelines
When reviewing contributions:- ✅ Check that code follows style guidelines
- ✅ Verify no
anytypes are used (unless absolutely necessary with justification) - ✅ Ensure exercises are appropriate difficulty level
- ✅ Confirm TypeScript errors are clear and educational
- ✅ Test that solutions actually resolve all type errors
- ✅ Validate that documentation is clear and helpful
Getting Help
Open an Issue
Ask questions or report bugs on GitHub
Provide Feedback
Share your thoughts with the project creator
TypeScript Docs
Refer to official TypeScript documentation
Community
Engage with other contributors
Additional Tips
- Keep exercises focused and concise
- Use realistic scenarios from actual development
- Make exercises enjoyable and engaging
- Progressive difficulty is key to learning
- Test thoroughly before submitting
Thank you for contributing to TypeScript Exercises! Your efforts help developers worldwide improve their TypeScript skills.