The official TypeScript template for Create React App providing preconfigured TypeScript support and development environment setup.
Overall
score
98%
Create a utility that inspects a TypeScript configuration file and reports whether it still matches the strict defaults generated by cra-template-typescript.
The CRA defaults to enforce include: target: "es5", lib: ["dom", "dom.iterable", "es6"], allowJs: true, skipLibCheck: true, esModuleInterop: true, allowSyntheticDefaultImports: true, strict: true, forceConsistentCasingInFileNames: true, noFallthroughCasesInSwitch: true, module: "esnext", moduleResolution: "node", resolveJsonModule: true, isolatedModules: true, noEmit: true, jsx: "react-jsx", and include: ["src"].
strict flipped to false or lib missing dom.iterable), the validator returns fail with explicit option names and expected vs actual values for each deviation. @testbaseUrl or paths) do not trigger a failure; they are captured separately in an extras list while status stays pass when defaults are unchanged. @test@generates
export type CraStrictOption =
| 'target'
| 'lib'
| 'allowJs'
| 'skipLibCheck'
| 'esModuleInterop'
| 'allowSyntheticDefaultImports'
| 'strict'
| 'forceConsistentCasingInFileNames'
| 'noFallthroughCasesInSwitch'
| 'module'
| 'moduleResolution'
| 'resolveJsonModule'
| 'isolatedModules'
| 'noEmit'
| 'jsx'
| 'include';
export interface CraDefaults {
compilerOptions: {
target: 'es5';
lib: ['dom', 'dom.iterable', 'es6'];
allowJs: true;
skipLibCheck: true;
esModuleInterop: true;
allowSyntheticDefaultImports: true;
strict: true;
forceConsistentCasingInFileNames: true;
noFallthroughCasesInSwitch: true;
module: 'esnext';
moduleResolution: 'node';
resolveJsonModule: true;
isolatedModules: true;
noEmit: true;
jsx: 'react-jsx';
};
include: ['src'];
}
export interface ValidationIssue {
option: CraStrictOption;
expected: unknown;
actual: unknown;
}
export interface ValidationResult {
status: 'pass' | 'fail';
missing: CraStrictOption[];
mismatched: ValidationIssue[];
extras: string[];
summary: string;
}
export function loadCraStrictDefaults(): CraDefaults;
export function validateTsconfig(configPath: string): ValidationResult;
export function correctedConfig(configPath: string): {
corrected: Record<string, unknown>;
correctedOptions: CraStrictOption[];
};Provides the CRA TypeScript template and its strict tsconfig defaults.
Install with Tessl CLI
npx tessl i tessl/npm-cra-template-typescript