Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
▶️ Check online playground
# ✨ Auto-detect
npx nypm install untyped
# npm
npm install untyped
# yarn
yarn add untyped
# pnpm
pnpm install untyped
# bun
bun install untyped
# deno
deno install untyped
First we have to define a reference object that describes types, defaults, and a $resolve
method (normalizer).
const defaultPlanet = {
name: "earth",
specs: {
gravity: {
$resolve: (val) => Number.parseFloat(val),
$default: "9.8",
},
moons: {
$resolve: (val = ["moon"]) => [val].flat(),
$schema: {
title: "planet moons",
},
},
},
};
resolveSchema
import { resolveSchema } from "untyped";
const schema = await resolveSchema(defaultPlanet);
Output:
{
"properties": {
"name": {
"type": "string",
"default": "earth"
},
"specs": {
"properties": {
"gravity": {
"default": 9.8,
"type": "number"
},
"moons": {
"title": "planet moons",
"default": ["moon"],
"type": "array",
"items": [
{
"type": "string"
}
]
}
},
"type": "object"
}
},
"type": "object"
}
generateTypes
import { resolveSchema, generateTypes } from "untyped";
const types = generateTypes(await resolveSchema(defaultPlanet));
Output:
interface Untyped {
/** @default "earth" */
name: string;
specs: {
/** @default 9.8 */
gravity: number;
/**
* planet moons
* @default ["moon"]
*/
moons: string[];
};
}
generateMarkdown
import { resolveSchema, generateMarkdown } from "untyped";
const markdown = generateMarkdown(await resolveSchema(defaultPlanet));
Output:
# `name`
- **Type**: `string`
- **Default**: `"earth"`
# `specs`
## `gravity`
- **Type**: `number`
- **Default**: `9.8`
## `moons`
- **Type**: `array`
- **Default**: `["moon"]`
corepack enable
(use npm i -g corepack
for Node.js < 16.10)pnpm install
pnpm dev
pnpm web
to start playground websitepnpm test
before push to ensure all tests and lint checks passingThanks to @dominikschreiber for donating package name.
v1.5.2
citty
(#150)FAQs
<!-- automd:badges bundlejs -->
The npm package untyped receives a total of 676,535 weekly downloads. As such, untyped popularity was classified as popular.
We found that untyped demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.