@fundingpips/typescript-config
v2.1.2
Published
Shareable TypeScript configurations for FundingPips projects
Maintainers
Readme
@fundingpips/typescript-config
Shareable TypeScript configurations for FundingPips projects. This package provides strict, self-contained TypeScript configurations optimized for different project types.
Features
- ✨ Maximum Type Safety - Inlines strict compiler options for the highest level of type checking
- 📦 Multiple Presets - Configurations for Next.js, React Native, Node.js, Vite, and libraries
- 🎯 Consistent Standards - Unified settings across all FundingPips projects
- ⚡ Performance Optimized - Incremental builds and smart defaults
- 🚀 Minimal Config - Works with project-local overrides only where TypeScript requires them
Installation
# npm
npm install --save-dev @fundingpips/typescript-config
# yarn
yarn add -D @fundingpips/typescript-config
# pnpm
pnpm add -D @fundingpips/typescript-configUsage
Next.js Projects
{
"extends": "@fundingpips/typescript-config/next"
}React Native Projects
{
"extends": "@fundingpips/typescript-config/react-native"
}Node.js Projects (CommonJS)
{
"extends": "@fundingpips/typescript-config/node"
}Node.js Projects (ESM)
{
"extends": "@fundingpips/typescript-config/node-esm"
}Vite React Projects
{
"extends": "@fundingpips/typescript-config/vite"
}Library Projects
{
"extends": "@fundingpips/typescript-config/library"
}Base Configuration (Advanced)
For custom configurations, extend the base:
{
"extends": "@fundingpips/typescript-config/base",
"compilerOptions": {
// Your custom options
}
}Available Configurations
| Configuration | Description | Use Case |
| --------------- | -------------------- | ---------------------------------- |
| /next | Next.js applications | SSR/SSG React apps with App Router |
| /react-native | React Native apps | Mobile applications |
| /node | Node.js CommonJS | Traditional Node.js services |
| /node-esm | Node.js ES Modules | Modern Node.js with ESM |
| /vite | Vite React apps | SPA React applications |
| /library | Libraries | Publishable packages |
| /base | Base configuration | Custom setups |
Features by Configuration
All Configurations Include
- ✓ Strict type checking (via inlined strict options)
- ✓ JSON module imports
- ✓ ES module interop
- ✓ Incremental compilation
- ✓ Source maps
Configuration-Specific Features
Next.js (/next)
- JSX preserve mode for Next.js processing
- DOM library types
- Next.js plugin support
- Optimized for App Router
- Inherits the shared ES2022 target
React Native (/react-native)
- React Native JSX transform
- Mobile-optimized library selection
- Jest types included
- Support for
.moniconfiles
Node.js (/node, /node-esm)
- Node.js type definitions
- Compiled output to
dist/ - Declaration files generation
- CommonJS or ESM modules
Vite (/vite)
- Vite client types
- React JSX runtime
- Hot module replacement support
- Build optimization settings
Library (/library)
- Declaration file generation
- Multiple module format support
- Stripped internal APIs
- Composite project support
Strictness Settings
All configurations include the strictest TypeScript settings for maximum type safety:
// Core strict settings
strict: true;
noImplicitAny: true;
strictNullChecks: true;
strictFunctionTypes: true;
strictBindCallApply: true;
strictPropertyInitialization: true;
noImplicitThis: true;
alwaysStrict: true;
// Additional strictness
allowUnusedLabels: false;
allowUnreachableCode: false;
exactOptionalPropertyTypes: true;
noFallthroughCasesInSwitch: true;
noImplicitOverride: true;
noImplicitReturns: true;
noPropertyAccessFromIndexSignature: true;
noUncheckedIndexedAccess: true;
noUnusedLocals: true;
noUnusedParameters: true;Path Aliases
Path aliases are intentionally not configured by default. They encode a project layout and import convention, so they belong in the consumer project's tsconfig.json.
If a project uses @/* for its local src directory, declare it explicitly:
{
"extends": "@fundingpips/typescript-config/next",
"compilerOptions": {
"paths": {
"@/*": ["${configDir}/src/*"]
}
}
}Migration Guide
From Custom tsconfig
- Install the package:
pnpm add -D @fundingpips/typescript-config- Update your
tsconfig.json:
{
"extends": "@fundingpips/typescript-config/next",
"compilerOptions": {
// Only add overrides if absolutely necessary
}
}- Remove redundant options that are now inherited
Common Overrides
If you need to override settings:
{
"extends": "@fundingpips/typescript-config/next",
"compilerOptions": {
// Allow JavaScript files (not recommended)
"allowJs": true,
// Project-local import aliases
"paths": {
"@/*": ["${configDir}/src/*"],
"@components/*": ["${configDir}/src/components/*"]
}
}
}Troubleshooting
No inputs were found
This package does not ship include or exclude values. TypeScript resolves those paths relative to the file that declares them, so shared configs cannot define them safely. Add project-local values in your tsconfig.json:
{
"extends": "@fundingpips/typescript-config/next",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}"Cannot find module" errors
This package does not define import aliases. Declare aliases in the consumer tsconfig.json:
{
"extends": "@fundingpips/typescript-config/next",
"compilerOptions": {
"paths": {
"@/*": ["${configDir}/src/*"],
"@components/*": ["${configDir}/src/components/*"]
}
}
}React Native specific issues
For React Native projects with custom file extensions:
{
"extends": "@fundingpips/typescript-config/react-native",
"include": ["src", "index.js", "custom.d.ts"]
}Node.js module resolution
For Node.js projects, ensure your package.json has the correct type:
// For ESM
{
"type": "module"
}
// For CommonJS (default)
{
"type": "commonjs"
}Dependencies
This package is self-contained and does not depend on external tsconfig base packages at runtime. The shared presets inline the strict compiler options directly so consumers do not need resolver support for nested extends.
Development uses:
typescript- Validates all shipped configurationsoxfmt- Formats JSON, Markdown, and JavaScript/TypeScript config fileshuskyandlint-staged- Run formatting on staged files
Development
Testing
# Validate all configurations
pnpm test
# Validate a specific configuration
pnpm test:config next
# Format code
pnpm format
# Check formatting
pnpm format:checkProject Structure
├── bases/ # TypeScript configuration presets
│ ├── base.json # Base configuration (all others extend this)
│ ├── next.json # Next.js configuration
│ ├── react-native.json
│ ├── node.json
│ ├── node-esm.json
│ ├── vite.json
│ └── library.json
├── scripts/ # Validation scripts
│ ├── validate-all.sh # Validates all configs
│ └── validate-config.sh # Validates single config
└── .github/workflows/ # CI/CD pipelines
├── ci.yml # Test on push/PR
└── publish.yml # Publish to npm on releaseContributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
License
MIT © FundingPips
Support
For issues and questions, please open an issue.
Made with ❤️ by the FundingPips team
