
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
typechecked
Advanced tools
Runtime type checking for typescript & javascript.
typechecked is a runtime type checker for typescript & javascript. It allows you to define types and check if a value matches that type. In typescript, it enables you to narrow the type of a value based on a type check.
npm install typechecked
Typechecked is based on the idea of a simple function, that accepts an unknown value and returns it if it matches a given type. If the value does not match the type, an error is thrown.
function value(value: unknown): KnownType {
// throw if value does not match type
return value as KnownType;
}
The library provides a set of these functions for all primitive types, arrays, objects, tuples, unions, intersections, and more. Types that are more domain specific can easily be defined by the consumer.
import { isString } from 'typechecked';
import { isNumber } from 'typechecked';
import { isInteger } from 'typechecked';
import { isBigInt } from 'typechecked';
import { isBoolean } from 'typechecked';
import { isNully } from 'typechecked';
import { isNull } from 'typechecked';
import { isUndefined } from 'typechecked';
import { isSymbol } from 'typechecked';
import { isDate } from 'typechecked';
import { isObject } from 'typechecked';
import { isFunction } from 'typechecked';
Pipe functions are used to combine multiple type checks into one. They are useful when you want to check if a value matches other conditions apart from just the type. Or if you want to transform a value from the original type before returning it.
import { tcpipe, tcpipe_t } from 'typechecked';
Used when piping functions but the value must be of one type.
const validator = tcpipe(
isString,
(value) => value.toUpperCase(),
);
const value: string = validator('hello'); // value === 'HELLO'
Useful when the value is transformed to a different type.
const validator = tcpipe_t(
isString,
isHex,
(value) => parseInt(value, 16),
);
const value: number = validator('FF1233'); // value === 16716339
FAQs
Typescript runtime type validation
The npm package typechecked receives a total of 0 weekly downloads. As such, typechecked popularity was classified as not popular.
We found that typechecked 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.