
Security News
Suno Breached via Shai-Hulud Worm, Leaked Code Exposes AI Music Scraping
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.
@cerios/openapi-to-typescript
Advanced tools
Generate TypeScript types from OpenAPI specifications.
type declarations from OpenAPI schemasenum, union, or const object from OpenAPI enumsnpm install @cerios/openapi-to-typescript
# Initialize a config file
npx openapi-to-typescript init
# Generate types
npx openapi-to-typescript generate
Create a openapi-to-typescript.config.ts file:
import { defineConfig } from "@cerios/openapi-to-typescript";
export default defineConfig({
input: "./openapi.yaml",
outputTypes: "./src/types.ts",
// Output format for enums: 'enum', 'union' (default), or 'const-object'
enumFormat: "union",
});
import { TypeScriptGenerator } from "@cerios/openapi-to-typescript";
const generator = new TypeScriptGenerator({
input: "./openapi.yaml",
outputTypes: "./src/types.ts",
enumFormat: "union",
});
// Generate and write to file
generator.generate();
// Or generate as string
const code = generator.generateString();
| Option | Type | Default | Description |
|---|---|---|---|
input | string | - | Path to OpenAPI specification (YAML or JSON) |
outputTypes | string | - | Output file path for generated types |
enumFormat | 'enum' | 'union' | 'const-object' | 'union' | How to generate enums |
includeDescriptions | boolean | true | Include JSDoc comments |
defaultNullable | boolean | false | Treat properties as nullable by default |
stripSchemaPrefix | string | string[] | - | Remove prefix from schema names (supports glob) |
stripPathPrefix | string | - | Remove prefix from paths |
useOperationId | boolean | true | Use operationId for operation-derived type names when available |
prefix | string | - | Add prefix to generated type names |
suffix | string | - | Add suffix to generated type names |
operationFilters | object | - | Filter operations by tags, paths, methods |
showStats | boolean | true | Include generation statistics |
batchSize | number | 10 | Parallel processing batch size |
union (default):
export type Status = "active" | "inactive" | "pending";
enum:
export enum Status {
Active = "active",
Inactive = "inactive",
Pending = "pending",
}
const-object:
export const Status = {
Active: "active",
Inactive: "inactive",
Pending: "pending",
} as const;
export type Status = (typeof Status)[keyof typeof Status];
MIT
FAQs
Generate TypeScript types from OpenAPI specifications
We found that @cerios/openapi-to-typescript 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
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.

Security News
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.