TypeScript
Introduction
This package provides the shared TypeScript configurations for the entire FRAME monorepo. Each preset targets a specific runtime environment and extends a strictly typed base set of compiler options.
Available presets
Section titled “Available presets”| Preset | Import path | Recommended use |
|---|---|---|
base | @frame/tsconfig/base | Base for all presets. Do not use directly. |
next | @frame/tsconfig/next | Next.js applications with App Router |
nest | @frame/tsconfig/nest | NestJS applications with decorators |
node | @frame/tsconfig/node | Node.js scripts and CLIs |
react-library | @frame/tsconfig/react-library | React libraries without a framework |
Preset architecture
Section titled “Preset architecture”All presets extend base.json and only override the options required for their environment:
graph TD base["base.json"] --> next["next.json"] base --> nest["nest.json"] base --> node["node.json"] base --> react["react-library.json"]
Notable base options
Section titled “Notable base options”The base preset sets the following compiler options as the starting point for all packages:
| Option | Value | Purpose |
|---|---|---|
strict | true | Enables all strict TypeScript checks |
noImplicitAny | true | Forbids implicit any |
strictNullChecks | true | Distinguishes null and undefined from other types |
noUnusedLocals | true | Errors on unused local variables |
noUnusedParameters | true | Errors on unused function parameters |
noImplicitOverride | true | Requires the override keyword when overriding methods |
noImplicitReturns | true | Requires an explicit return on all branches |
noFallthroughCasesInSwitch | true | Forbids fallthrough in switch |
target | es2022 | Modern compilation target |
module | esnext | Native ES modules |
moduleResolution | bundler | Resolution optimized for modern bundlers |
isolatedModules | true | Compatible with per-file transpilation (esbuild, SWC) |
incremental | true | Incremental compilation for speed |
resolveJsonModule | true | Allows importing .json files |
skipLibCheck | true | Skips type checking of third-party .d.ts files |
erasableSyntaxOnly | false | Allows non-erasable TypeScript syntax (decorators) |
Preset details
Section titled “Preset details”Extends base and enables the Next.js plugin for IDE analysis:
{ "extends": "./base.json", "compilerOptions": { "jsx": "react-jsx", "plugins": [{ "name": "next" }] }}Extends base and enables decorators for NestJS:
{ "extends": "./base.json", "compilerOptions": { "target": "ES2023", "emitDecoratorMetadata": true, "experimentalDecorators": true, "declaration": true, "sourceMap": true, "removeComments": true, "noImplicitAny": false, "noUnusedLocals": false, "noUnusedParameters": false, "noImplicitOverride": false }}Extends base and adds Node.js types:
{ "extends": "./base.json", "compilerOptions": { "types": ["node"] }}Extends base and enables JSX for React libraries:
{ "extends": "./base.json", "compilerOptions": { "jsx": "react-jsx" }}How to use it in a new package
Section titled “How to use it in a new package”- Add the package as a development dependency:
package.json {"devDependencies": {"@frame/tsconfig": "workspace:*"}} - Create a
tsconfig.jsonat the package root and extend the appropriate preset:tsconfig.json {"extends": "@frame/tsconfig/base","compilerOptions": {"outDir": "dist"},"include": ["src"],"exclude": ["node_modules", "dist"]} - Select the correct preset for the environment:
| Environment | Preset |
|---|---|
| Next.js | @frame/tsconfig/next |
| NestJS | @frame/tsconfig/nest |
| Node.js / CLI | @frame/tsconfig/node |
| React library | @frame/tsconfig/react-library |
NestJS
Next.js
TypeScript Plugin for Next.js