TypeScript Configuration
Relevant source files
The following files were used as context for generating this wiki page:
TypeScript Configuration defines the compiler settings and type environment for the FOSSBilling branding project. It ensures type safety and modern JavaScript compatibility for asset generation scripts and automated tests without requiring a transpilation build step.
The project uses TypeScript primarily for type checking and providing Intellisense during development. The scripts run directly in Node.js (v24 or newer) using standard Node.js execution methods, utilizing TypeScript's ability to describe complex asset manifests and configuration structures.
Sources: tsconfig.json:1-13, README.md:68-71, package.json:13-17
Compiler Options
The project targets modern ECMAScript environments and integrates closely with Node.js modules. The configuration prioritizes strict type safety while allowing the direct import of .ts files.
Core Settings
The configuration uses the following key compiler options:
| Option | Value | Description |
|---|---|---|
target | ES2023 | Sets the JavaScript language version for emitted output. |
module | NodeNext | Specifies the module system for Node.js compatibility. |
strict | true | Enables all strict type-checking options. |
noEmit | true | Prevents the compiler from saving output files (type-check only). |
allowImportingTsExtensions | true | Allows imports to use the .ts extension. |
verbatimModuleSyntax | true | Simplifies the handling of type-only imports and exports. |
Sources: tsconfig.json:2-10
Inclusion Scope
The TypeScript compiler monitors two specific directories for source files and tests.
The diagram shows the file patterns included in the TypeScript compilation scope.
Sources: tsconfig.json:12
Type Definitions and Data Structures
The configuration relies on explicit interface definitions located in scripts/types.ts. these interfaces govern the structure of assets, variants, and the final manifest generated by the system.
Asset Manifest Schema
The AssetManifest interface defines the structure of the manifest.json file produced during asset generation.
| Field | Type | Description |
|---|---|---|
exportedAt | string | UTC timestamp of the export. |
files | Asset[] | A collection of all generated asset objects. |
Sources: scripts/types.ts:18-21
Asset Interface
The Asset interface describes individual files within the manifest, including their dimensions and variants.
export interface Asset {
path: string;
variant: string | null;
type: 'icon' | 'logo' | 'favicon' | 'apple-touch-icon' | 'preview';
format: string;
width?: number;
height?: number;
sizes?: number[];
variants?: string[];
}
Sources: scripts/types.ts:7-16
Execution Environment
The TypeScript configuration supports a "no-build" workflow where scripts are executed via Node.js directly.
Development Scripts
The package.json defines the interaction between the TypeScript configuration and the execution environment.
- Type Checking:
npm run typecheckexecutestsc --noEmitto validate the codebase against the rules intsconfig.json. - Asset Generation:
npm run generateruns thescripts/generate-assets.tsscript using Node.js. - Testing:
npm testtriggers the native Node.js test runner for.tsfiles.
Sources: package.json:5-9
Dependencies
The project uses several external type definitions and tools to support the TypeScript environment:
typescript: Version 7.0.2 (as listed in devDependencies).@types/node: Version 24.19.2 for Node.js API types.sharp: For image processing type safety.svgo: For SVG optimization configuration types.
Sources: package.json:13-17, scripts/svgo.config.ts:1
Summary
The TypeScript configuration in the FOSSBilling branding repository establishes a strict, modern development environment. By leveraging NodeNext module resolution and noEmit validation, the project maintains high code quality for its utility scripts while remaining lightweight and compatible with the latest Node.js versions.