Skip to content

Version Packages#529

Merged
mattiamanzati merged 1 commit intomainfrom
changeset-release/main
Dec 9, 2025
Merged

Version Packages#529
mattiamanzati merged 1 commit intomainfrom
changeset-release/main

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Dec 9, 2025

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@effect/language-service@0.62.0

Minor Changes

  • #528 7dc14cf Thanks @mattiamanzati! - Add typeToSchema codegen

    This adds a new // @effect-codegens typeToSchema codegen that automatically generates Effect Schema classes from TypeScript types. Given a type alias with object members representing schemas to generate (e.g., type ToGenerate = { UserSchema: User, TodoSchema: Todo }), the codegen will create the corresponding Schema class definitions.

    The generated schemas:

    • Automatically detect and reuse existing schema definitions in the file
    • Support both type aliases and interfaces
    • Include outdated detection to warn when the source type changes
    • Work with the outdatedEffectCodegen diagnostic to provide automatic fix actions

    Example usage:

    type User = {
      id: number;
      name: string;
    };
    
    // @effect-codegens typeToSchema
    export type ToGenerate = {
      UserSchema: User;
    };
    
    // Generated by the codegen:
    export class UserSchema extends Schema.Class<UserSchema>("UserSchema")({
      id: Schema.Number,
      name: Schema.String,
    }) {}

Patch Changes

  • #530 5ecdc62 Thanks @mattiamanzati! - Fix Refactor to Schema (Recursive Structural) to support exactOptionalPropertyTypes

    When exactOptionalPropertyTypes is enabled in tsconfig, optional properties with types like string | undefined are not assignable to types defined as prop?: string. This fix generates Schema.optionalWith(Schema.String, { exact: true }) instead of Schema.optional(Schema.Union(Schema.Undefined, Schema.String)) to maintain type compatibility with external libraries that don't always include undefined in their optional property types.

    Example:

    // With exactOptionalPropertyTypes enabled
    type User = {
      name?: string; // External library type (e.g., Stripe API)
    };
    
    // Generated schema now uses:
    Schema.optionalWith(Schema.String, { exact: true });
    
    // Instead of:
    Schema.optional(Schema.Union(Schema.Undefined, Schema.String));

    This ensures the generated schema maintains proper type compatibility with external libraries when using strict TypeScript configurations.

@github-actions github-actions bot force-pushed the changeset-release/main branch from ff4873b to 4d4eed6 Compare December 9, 2025 18:58
@mattiamanzati mattiamanzati merged commit 4b1cecb into main Dec 9, 2025
@mattiamanzati mattiamanzati deleted the changeset-release/main branch December 9, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant