Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .changeset/class-facade-static-interfaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@effect/tsgo": patch
---

declarations: facet bare-imported class schemas and emit static class namespace interfaces

Two facade-emit gaps under newer effect Schema types:

- Heritage detection only matched namespaced constructors (`S.Class(...)` /
`Schema.Opaque(...)`); a bare named import (`import { Class } from "effect-app/Schema"`
→ `class X extends Class<X>(...)`) was not recognized, so the class base kept its
fully-inlined `EnhancedClass<X, Struct<{…all fields…}>>` instead of the compact
`OpaqueClassFacade<X, X.Encoded, …>`. Now both heritage shapes are recognized.

- The class static-property resolver (`CreateTypeOfClassStaticProperty`) serialized
`Type`/`Encoded`/`Make`/`Fields` via the node builder, which under effect #2442 keeps
the deferred mapped helper (`Struct.ReadonlySide<…>`) as a reference — regressing the
generated namespace from static interfaces to mapped-type aliases. Now object-typed
properties are expanded to static `interface`s (matching the struct-facade path);
callable members (`never` services, the base `mapFields`/`copy`) keep their signatures.
18 changes: 18 additions & 0 deletions .changeset/struct-facade-companion-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"@effect/tsgo": patch
---

declarations: keep a companion type for faceted struct schemas instead of dropping it

The effect-schema struct facade transform dropped the `export type X = typeof X.Type`
companion of a `const X = S.Struct(...)` model, but only emitted the replacement
`interface X` when the decoded `Type` materialized as an object literal. Under newer
effect Schema types `.Type` can resolve to a mapped type (e.g.
`Struct.ReadonlySide<…, "Type">`), so the facade builder bailed, the const stayed
un-faceted, and the companion alias was dropped with no replacement — leaving `X`
value-only and breaking cross-module `import { type X }` usage (TS2749) under faceted
resolution.

Now the builder emits the decoded `Type` as a `type X = …` alias when it is not an
object literal (keeping the `interface X` form when it is), and the companion alias is
only dropped when the struct was actually faceted; otherwise the original alias is kept.
Loading