Skip to content

ProtectionLevel

ts
type ProtectionLevel = "none" | "boundary" | "sandbox" | "hardened";

WARNING

This is an input type for APIs like JSTypeChecker. It is usually configured, not manipulated at runtime.

TIP

Pro tip: Use none if you are sure you are using the library correctly and want to avoid any overhead from warnings. Use boundary for a good balance of safety and performance. Use sandbox if you want extra hints to help you use the library correctly. Use hardened if you want maximum safety and are okay with errors being thrown instead of fallbacks.

Represents strictness for JSTypeChecker.

  • none: No protection and no warnings.
  • boundary: Warnings for invalid usage, often with fallbacks.
  • sandbox: Boundary behavior plus richer hints.
  • hardened: Throws on invalid usage; no fallback behavior.

Diagram

100%Ctrl + wheel to zoom