Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ark/schema

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ark/schema

Underlying schema language parsed from arktype syntax.

  • 0.20.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44K
increased by0.19%
Maintainers
1
Weekly downloads
 
Created
Source

@ark/schema

Underlying schema language parsed from arktype syntax.

UNDER DEVELOPMENT

The parts of ArkType's type system that exist in TS (i.e. not runtime-only constraints like bounds, divisors, custom predicates, morphs etc.) are structured like this:

  • Union: a set of intersections
  • Intersection: a set of a basis and constraints
  • Basis: this is the base type to which refinements like props are applied. It is one of three things, getting narrower as you move down the list:
    • Domain: "string" | "number" | "bigint" | "object" | "symbol" parallels built-in TS keywords for non-enumerable value sets
    • Proto: Must be an instanceof some class (implies domain "object")
    • Unit: Must === some value (can be intersected with any other constraint and reduced to itself or a disjoint)
  • Constraint: an individual condition that must be satisfied:
    • Required: must have a specified literal string or symbol key and a value that conforms to a specified union or intersection
    • Optional: Required conditions met or the specified key is not present
    • Index: all keys that satisfy an index type must have values satisfying the corresponding value type

In this system, L extends/subtypes/is assignable to R if and only if the intersection L & R is equal to L.

FAQs

Package last updated on 25 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc