Skip to main content
TypeScript’s type checking options determine the stability of your code. Sonamu enables strict mode by default to provide maximum type safety.

Strict Mode

Sonamu enables all strict options.
strict: true is a shortcut that enables all the above options at once.

Strict Options in Detail

Require Explicit any Type

Function:
  • Prevents implicit use of any when type cannot be inferred
Example:
If typing is difficult, use unknown. It’s safer than any.

Additional Type Check Options

Sonamu enables additional check options beyond strict mode.

Warn About Unused Code

Example:
Parameters starting with _ don’t trigger warnings.

Stricter Options (Optional)

Options you can add as needed.
Index signatures can only be accessed with brackets
When to use:
  • When you want to make dynamic property access explicit
Optional properties only allow undefined
When to use:
  • When you want to strictly distinguish between optional and | undefined
May have compatibility issues with many libraries.

Disabling Type Checks

Sometimes you need to bypass type checks in specific situations.
For new projects, enable all options.

Performance Considerations

More type check options can increase compilation time.
skipLibCheck
  • Don’t check .d.ts files in node_modules
  • Significantly reduces compilation time
  • Enabled by default in Sonamu
incremental
  • Only recompile changed files
  • Cache stored in .tsbuildinfo file

Next Steps

tsconfig.json

Check the complete TypeScript configuration

Path Mapping

Set up absolute path imports

Entity Definition

Write type-safe Entities

Writing Tests

Write type-safe tests