Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
ts-typed-json
Advanced tools
This library is a set of type definitions and utilities for dealing with JSON data in a type-safe way with TypeScript.
The most important type definitions are JSON.Value
, JSON.Object
,
and JSON.Array
, which correspond respectively to JSON values,
objects, and arrays, as the names suggest.
The library also exports safely-typed versions of the standard JSON.parse()
and JSON.stringify()
functions.
import * as JSON from 'ts-typed-json';
interface JSON.Object extends Record<string, JSON.Value> {}
interface JSON.Array extends Array<JSON.Value> {}
type JSON.Value = null | boolean | number | string | JSON.Object | JSON.Array;
Tests if a JSON value is null
.
Tests if a JSON value is a boolean.
Tests if a JSON value is a number.
Tests if a JSON value is a string.
Tests if a JSON value is a JSON object.
Tests if a JSON value is a JSON array.
Casts a JSON value to null
, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a boolean, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a number, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a string, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a JSON object, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Casts a JSON value to a JSON array, throwing a TypeError
if it fails.
The optional prefix
argument allows callers to provide a contextual
string describing the value that is being tested, for the sake of
generating useful error messages in the case of a type error.
Parses a source string as a JSON value.
Serializes a JSON value to a string.
Synchronously loads a JSON value from the filesystem.
Asynchronously loads a JSON value from the filesystem.
FAQs
JSON types and utilities for TypeScript.
We found that ts-typed-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.