Repository navigation
v0.59.0
Minor Changes
-
#518
660549dThanks @mattiamanzati! - Add newschemaStructWithTagdiagnostic that suggests usingSchema.TaggedStructinstead ofSchema.Structwhen a_tagfield withSchema.Literalis present. This makes the tag optional in the constructor, improving the developer experience.Example:
// Before (triggers diagnostic) export const User = Schema.Struct({ _tag: Schema.Literal("User"), name: Schema.String, age: Schema.Number, }); // After (applying quick fix) export const User = Schema.TaggedStruct("User", { name: Schema.String, age: Schema.Number, });
The diagnostic includes a quick fix that automatically converts the
Schema.Structcall toSchema.TaggedStruct, extracting the tag value and removing the_tagproperty from the fields.
Patch Changes
-
#521
61f28baThanks @mattiamanzati! - Fix auto-completion for directly imported Effect APIs. Completions now work when using direct imports likeimport { Service } from "effect/Effect"instead of only working with fully qualified names likeEffect.Service.This fix applies to:
Effect.ServiceandEffect.Tagfromeffect/EffectSchema.Class,Schema.TaggedError,Schema.TaggedClass, andSchema.TaggedRequestfromeffect/SchemaData.TaggedErrorandData.TaggedClassfromeffect/DataContext.Tagfromeffect/Context
Example:
// Now works with direct imports import { Service } from "effect/Effect" export class MyService extends Service // ✓ Completion available // Still works with fully qualified names import * as Effect from "effect/Effect" export class MyService extends Effect.Service // ✓ Completion available
Fixes #394