Menu

1 / 6

Chuks Language Data Types

DEV Community·Chukwuemeka Igbokwe·6 months ago
#2dNEXEYb
Reading 0:00
15s threshold

Stop fighting your data. Let dataType win.

Most languages make you choose between the safety of structs and the convenience of maps. Chuks gives you both, with built-in validation, generics, embedding, and nullable safety baked right into the type system.

chuks dataType is a lightweight, fields-only container. No constructor boilerplate. No class overhead. Initialize with a map literal and the compiler checks every field.

@validate : one annotation, full validation.

Attach validation rules directly to fields. Call validate(x) and get back every error. No third-party library. No schema duplication. It lives with your data.

Custom validators: your rules, first class

Need a strongPassword rule? Write a function, annotate it with @validator, and use it in any dataType across your whole codebase, including imported modules.

Nullable types + type narrowing

Append ? to any type and it can hold null. Chuks does control-flow analysis, after a null guard, the compiler narrows the type automatically. No casts.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.