
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@runtyping/zod
Advanced tools
Generate zod from static types & JSON schema.
npm install zod
npm install -D @runtyping/zod
Create a file, in the root of your project, called "runtyping.yml".
# runtyping.yml
targetFile: ./src/other-runtypes.ts # The file to create
runtypeFormat: {type}Rt # Optional: use a custom name format for the created runtype
transformers: # Optional: specify a transformer for a type
[TYPENAME]:
file: /path/to/transformer
export: exportNameOfTranformer
typeFormat: {type}Type # Optional: use a custom name format for the created type
sourceTypes:
exportStaticType: true # Optional: export static types as well (true by default)
file: ./src/types.ts # The file where your type lives
type: Foo # The type you want to convert to a runtype
You can also specify a list of target files, if you want to create more than one:
# runtyping.yml
- targetFile: ./src/other-runtypes.ts
sourceTypes:
file: ./src/types.ts
type: Foo
- targetFile: ./src/runtypes.ts
sourceTypes:
# Source types can also be a list
- file: ./src/types.ts
type: Foo
- file: ./json/my-json-schema.json # You can even use JSON schema files!!
type: [ExampleType, AnotherExampleType] # You may use an array of types
Then run: npx runtyping
Basic example:
import { Generator } from '@runtyping/zod'
const generator = new Generator({
targetFile: './src/runtypes.ts',
// optional: runtypeFormat / typeFormat (see above)
})
generator
.generate([
{ file: './src/types.ts', type: 'Foo' },
{ file: 'json/my-json-schema.json', type: 'ExampleType' },
])
.then((file) => file.save())
import { Generator } from '@runtyping/zod'
const generator = new Generator({
targetFile: './src/runtypes.ts',
tsConfigFile: '/path/to/tsconfig.json',
})
(see generate.ts for the defaults)
import { Project } from 'ts-morph'
import { Generator } from '@runtyping/zod'
const generator = new Generator({
targetFile: './src/runtypes.ts',
project: new Project({
// ...
}),
})
FAQs
Generate zod from static types & JSON schema.
The npm package @runtyping/zod receives a total of 5,839 weekly downloads. As such, @runtyping/zod popularity was classified as popular.
We found that @runtyping/zod demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.