TypeScript Configuration
Configure TypeScript support with JS Style Kit
Overview
JS Style Kit provides TypeScript configuration through two mechanisms:
- TypeScript support in ESLint configuration
- Reusable TypeScript configuration files for your projects
TypeScript Support in ESLint
TypeScript support is enabled by default in the ESLint configuration. The typescript-eslint
plugin is automatically configured with sensible defaults.
Basic Configuration
Configuration Options
TypeScript Rules
When TypeScript support is enabled, JS Style Kit automatically configures the following:
- Type checking rules from
@typescript-eslint
- Best practices for TypeScript code
- Consistency rules for TypeScript syntax
- React-specific TypeScript rules when React support is enabled
Reusable TypeScript Configurations
JS Style Kit includes several reusable TypeScript configurations you can extend:
Using TypeScript Configuration
In your project, create a tsconfig.json
that extends from JS Style Kit’s configurations:
Available TypeScript Configurations
JS Style Kit provides the following TypeScript configurations:
Base Configuration (base.json
)
The base configuration provides sensible defaults for modern TypeScript projects:
Library Configuration (lib.json
)
For creating TypeScript libraries:
Documentation Configuration (docs.json
)
For documentation projects:
Customizing TypeScript Configuration
When creating your own tsconfig.json
, you can extend from one of these configurations and add your own custom settings:
TypeScript Integration Tips
Project References
For monorepos or projects with multiple packages, use TypeScript’s project references:
Path Aliases
Configure path aliases to simplify imports:
Don’t forget to configure your build tool (webpack, vite, etc.) to handle these path aliases as well.