![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
▶️ 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 399,644 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.