@canonical/typescript-config-react
v0.11.0
Published
Canonical's standard TypeScript configuration for React projects
Maintainers
Keywords
Readme
Canonical React Typescript Configuration
This package provides a central configuration for Canonical's React Typescript projects.
This configuration extends a base configuration, which provides more general TypeScript settings and is suitable for non-React projects.
Getting Started
- Install Typescript:
bun add -d typescript - Install this configuration:
bun add -d @canonical/typescript-config-react - Create a
tsconfig.jsonfile in the root of your project and extend this configuration.
{
"extends": "@canonical/typescript-config-react"
}Configuration
This configuration enables the following behavior:
DOMlibrary inclusion: Includes theDOMlibrary, providing types for the DOM and browser APIs.react-jsxtransform: Emits.jsxas.jswith the new React JSX transform, optimized for production usage.
History
This configuration is rooted in the Canonical React Components Typescript config. It has been generalized to support non-React projects and be more minimal.
React-specific changes to the original config are listed below. For non-React relevant changes, see the base configuration README.
"jsx": "react"→"jsx": "react-jsx": Transforms JSX to JS with modern React JSX optimizations, instead of with React.createElement. Enables usage of JSX without importing React.
