| name | effect-schema |
| description | Effect Schema naming conventions. Use when defining schemas for data validation and type inference. |
| user-invocable | false |
Effect Schema Conventions
Naming conventions for Effect Schema definitions.
Naming Pattern
Schema constants use the Schema suffix. Types are derived and exported without the suffix.
import { Schema } from "effect";
export const UserSchema = Schema.Struct({
id: Schema.String,
name: Schema.String,
email: Schema.String,
});
export type User = typeof UserSchema.Type;
Examples
export const ConfigSchema = Schema.Struct({
host: Schema.String,
port: Schema.Number,
});
export type Config = typeof ConfigSchema.Type;
export const SettingsSchema = Schema.Struct({
theme: Schema.optional(Schema.String),
verbose: Schema.optional(Schema.Boolean),
});
export type Settings = typeof SettingsSchema.Type;
export const ResultSchema = Schema.Union(
Schema.Struct({ type: Schema.Literal("success"), data: Schema.Unknown }),
Schema.Struct({ type: Schema.Literal("error"), message: Schema.String }),
);
export type Result = typeof ResultSchema.Type;
export const ItemsSchema = Schema.Array(Schema.String);
export type Items = typeof ItemsSchema.Type;
Checklist