Skip to main content
Version: 0.1.0-beta.9

Basic Types

This section demonstrates how to serialize and deserialize basic TypeScript types using Morphio. You'll find examples for:

String, Number, and Boolean

Learn how to handle primitive types with proper type information and validation. Examples show both required and optional properties.

Date Objects

See how Morphio automatically handles date serialization and deserialization, maintaining proper date object functionality.

Optional Properties

Understand how to work with optional properties while maintaining type safety.

Approaches

The examples in this section are presented in two formats:

Decorator-Based

Using TypeScript decorators for a clean, declarative approach. This is recommended for most use cases as it provides the best developer experience.

Schema-Based

Manual schema registration for cases where decorators cannot be used or more control is needed over the serialization process.

Choose the approach that best fits your needs and coding style. Both approaches provide the same level of type safety and functionality.