Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••••••
Sichere ProgrammierungAn uncalibrated classifier is worse than no classifier(02.10.2026 um 04:35 Uhr)
•
Sichere ProgrammierungI Surveyed 123 People in India to Benchmark Frontier AI(02.10.2026 um 04:36 Uhr)
•••••••••
Sichere ProgrammierungAn uncalibrated classifier is worse than no classifier(02.10.2026 um 04:35 Uhr)
•
Sichere ProgrammierungI Surveyed 123 People in India to Benchmark Frontier AI(02.10.2026 um 04:36 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

valicore: Runtime Type Validation for TypeScript (Schemas, Guards, Parsing)

TypeScript is great for catching type errors at compile time — but what about runtime? External API responses, form data, env vars — they're all untyped at run…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

TypeScript is great for catching type errors at compile time — but what about runtime? External API responses, form data, env vars — they're all untyped at runtime. valicore fixes that.






What is valicore?



A zero-dependency TypeScript validation library with full schema inference, type guards, and safe parsing.




npm install valicore
bun add valicore









Core Features






Schema Definition






import { v } from 'valicore';

const UserSchema = v.object({
id: v.number(),
name: v.string().min(1).max(100),
email: v.string().email(),
role: v.enum(['admin', 'user', 'guest']),
createdAt: v.date().optional()
});

type User = v.infer<typeof UserSchema>;
// Automatically inferred TypeScript type!









Safe Parsing






const result = UserSchema.safeParse(apiResponse);

if (result.success) {
console.log(result.data.email); // Fully typed!
} else {
console.error(result.errors); // Detailed error messages
}









Type Guards






if (UserSchema.is(data)) {
// data is narrowed to User type here
sendWelcomeEmail(data.email);
}









Nested Schemas






const OrderSchema = v.object({
id: v.string().uuid(),
user: UserSchema,
items: v.array(v.object({
productId: v.string(),
quantity: v.number().int().positive()
})),
total: v.number().positive()
});









Why valicore?




  • Zero dependencies

  • Automatic TypeScript type inference

  • Detailed, human-readable error messages

  • Composable and reusable schemas

  • Works with Node.js, Bun, Deno, and browsers






Install






npm install valicore






GitHub: https://github.com/Avinashvelu03/valicore



How do you handle runtime validation in your TypeScript projects? Drop your approach in the comments!

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten valicore: Runtime Type Validation for TypeScript (Schemas, Guards, Parsing)

Thematisch verwandte Begriffe: valicore, Runtime, Type, Validation · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag