Skip to content

Feature: Improve type system clarity and error messages #29

@sabine

Description

@sabine

Problem Statement

Working with Typemail'''s type system is confusing due to unclear distinctions between Section.t, Element.t, and when/how to convert between them. Error messages don'''t clearly indicate what'''s expected or how to fix type mismatches.

Specific Pain Points

  1. Type hierarchy confusion: Unclear when to use Section.t vs Element.t, and how they relate
  2. Composition errors: Error messages like "expected Element.t but got Section.t" don'''t explain how to convert or what went wrong
  3. API inconsistency: Section.v vs Section.make have different type signatures but similar purposes, unclear when to use which
  4. Element conversion: No clear guidance on how to properly convert between different element types

Impact

  • Steep learning curve for new users
  • Trial-and-error development to understand type system
  • Difficult to debug type errors in complex email templates
  • Unclear API design increases development time

Context

During email template refactoring, multiple compilation errors due to type mismatches. Error messages didn'''t indicate whether conversion was needed, how to convert, or what the actual type hierarchy is. This suggests the type system could be more self-documenting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    botbot bot bot

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions