Skip to content

@briklab/lib/jstc ​

Runtime type validation for JavaScript values with configurable protection levels.

Runtime Validation Only

JSTC validates at runtime and does not replace TypeScript compile-time type checking.

API ​

Quick Start ​

ts
import JSTC from "@briklab/lib/jstc";

JSTC.setProtectionLevel("boundary");
const isValid = JSTC.for([42]).check(["number"]); // true

Features ​

  • Singleton Pattern: Use the JSTC constant for quick, shared type checking
  • Custom Instances: Create JSTypeChecker instances for isolated validation
  • Protection Levels: Control validation strictness with different protection levels

Diagram ​

100%Ctrl + wheel to zoom

Live Demo ​

Recommended to test it in your browser. The test here might not work properly
Console
No logs yet.