_patches: layer the .d.ts-emit schema-facade emitter onto Effect-TS/tsgo#1
Open
patroza wants to merge 9 commits into
Open
_patches: layer the .d.ts-emit schema-facade emitter onto Effect-TS/tsgo#1patroza wants to merge 9 commits into
patroza wants to merge 9 commits into
Conversation
Re-expresses our effect-app/typescript-go#2 feature (class/error/struct schema facade declaration emit) as three `_patches/` entries, authored against the exact `typescript-go` submodule commit this repo pins (dc37b5249) — the same commit our codex baseline branched from, so they apply cleanly: 029-transformers-declarations-effect-schema.patch (declaration transformer) 030-checker-emitresolver-effect-schema.patch (CreateTypeOf* resolver) 031-printer-emitresolver-effect-schema.patch (EmitResolver interface) The feature is purely additive (no overlap with Effect patches 001-028). After `setup-repo` applies 001-031 and regenerates diagnostics, `go build ./cmd/tsgo` yields a tsgo with Effect's LSP hooks AND our .d.ts emitter. Verified on the macs/scanner src tree: 0 errors, 145 Effect LSP diagnostics (hooks live), and 56 StructFacade + 10 OpaqueClassFacade + 46 OpaqueErrorFacadeClass (emitter live). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…om emit) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ffect-app.5 Regenerate the .d.ts schema-facade patches verbatim from the canonical Go implementation in effect-app/typescript-go PR Effect-TS#2 (head a9dd01c, base dc37b524 == this submodule pin), restoring four improvements the earlier partial port dropped: - generated import normalization (prefer namespace imports over import("...")) - legacy `Encoded extends S.StructNestedEncoded` materialization - static-member rewriting (fields -> X.Fields, mapFields/copy signatures) - `Fields` interface in the generated namespace 029 transform.go +920 -> +1148; 030/031 unchanged in substance. Verified against scanner api decl build: exit 0, 0 StructNestedEncoded placeholders, 415 `Fields` interfaces emitted, Effect language service diagnostics live. Set the binary version suffix to semver build metadata on the upstream 7.x base: core.SetVersionSuffix("+effect-app.5") -> `tsgo --version` = 7.0.0-dev+effect-app.5 (replaces the old 0.14.x-effect-app.N scheme). Bump the counter per gz release. Source: effect-app/typescript-go#2 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
833e8d2 to
b3c2f3a
Compare
Drop the `export type X = typeof X.Type` companion of a `const X = S.Struct(...)`
model only when the struct is actually faceted, and emit the decoded `Type` as a
`type X = …` alias when it does not materialize as an object literal (newer effect
Schema `.Type` resolves to a mapped type). Previously the builder bailed and the
companion was dropped with no replacement, leaving `X` value-only and breaking
cross-module `import { type X }` (TS2749) under faceted resolution.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
_tools/cut-release.sh (pnpm release:cut) builds every platform tsgo binary, packages each as the gz asset that install-patched-compilers.mjs downloads, writes SHA256SUMS, and creates the effect-app/tsgo GitHub release. The version is derived from source (core version.go base + etscheckerhooks SetVersionSuffix) so the tag, release title and binary --version cannot drift; --dry-run and --skip-setup are supported. Bumps the build counter to +effect-app.6 for the struct-facade companion-type fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ded/Make createTypeOfStructSchemaProperty rendered the decoded property via TypeToTypeNode, which under newer effect Schema types kept the deferred mapped helper (e.g. `Struct.ReadonlySide<Fields, "Type">`) as a reference. That both regressed the facade's static-interface output and left the top-level `Type` a non-literal, so the struct facade builder bailed. Expand object-typed properties through createTypeLiteralOfType — the same path the class/request facades already use — so `X`, `Encoded`, `Make` and `Fields` emit as fully-expanded `interface`s; service channels (resolve to `never`) keep their direct node form. With static interfaces restored the declarations transformer no longer needs the type-alias fallback (reverted); the companion-alias drop stays gated on a struct actually being faceted. Bumps the build counter to +effect-app.7. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ce interfaces
Recognize bare named-import heritage constructors (`import { Class } from
"effect-app/Schema"`) in addition to `S.Class(...)`, so those classes get the
compact `OpaqueClassFacade<X, X.Encoded, …>` base instead of an inlined
`EnhancedClass<X, Struct<{…}>>`.
Expand the class static properties (`Type`/`Encoded`/`Make`/`Fields`) to static
`interface`s in `CreateTypeOfClassStaticProperty`, the same way the struct-facade
path does — under effect #2442 these otherwise degrade to mapped `Struct.ReadonlySide`
aliases. Callable members (services `never`, base `mapFields`/`copy`) keep their
signatures via a has-properties guard. Bumps to +effect-app.8.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layers the
.d.ts-emit effect-app schema-facade emitter onto Effect-TS/tsgo (Effect LSP hooks + this) as three_patches/entries.Correctness, not just performance
Past the checker's instantiation/depth limits the schema generics silently degrade to
unknown/any—DecodingServices/EncodingServices, constructor /makemembers,Type/Encoded— with no error reported. It is non-deterministic and worst under tsgo's default multi-threaded mode (each worker hits the wall independently). Materializing each view as a named static interface once at emit makes them fully resolved and stable for every program / project reference / worker; adopting it on the scanner surfaced several real bugs the silentany/unknownhad masked.typescript-goatdc37b5249; additive, no overlap with Effect's_patches/001-028.029-transformers-declarations(declaration transformer),030-checker-emitresolver(CreateTypeOf{Struct,Class}…Property),031-printer-emitresolver.S.StructFacade/S.OpaqueClassFacade/S.OpaqueErrorFacadeClass/S.OpaqueFacadefrom effect-app (≥ 4.0.0-beta.280).Fixes for newer effect Schema (
effect@4.0.0-beta.85, #2442)#2442made the decoded.Type/.Encoded/.Makeresolve to deferred mapped helpers (Struct.ReadonlySide<Fields, …>) instead of object literals. Restored static emit + closed two facade gaps:030): expandCreateTypeOfStructSchemaPropertythroughcreateTypeLiteralOfTypesoType/Encoded/Makestay static interfaces;029keeps the companiontype Xonly when faceted (no orphan-drop → no value-onlyTS2749).030):CreateTypeOfClassStaticPropertylikewise serialized via the node builder, so every faceted class's namespace degraded to mappedReadonlySidealiases. Now object properties expand to staticinterfaces; callable members (neverservices, basemapFields/copy) keep their signatures via a has-properties guard.029): heritage detection only matchedS.Class(...)— a bareimport { Class } from "effect-app/Schema"(class X extends Class<X>(...)) was missed, leaving the base as a fully-inlinedEnhancedClass<X, Struct<{…all fields…}>>. Now both heritage shapes facet to compactOpaqueClassFacade<X, X.Encoded, …>. On the scanner this removed all 14EnhancedClassinlinings;ReadonlySideclass-namespace aliases dropped to 0.Release & version —
effect-app.87.0.0-dev+effect-app.8(upstream typescript-go 7.x base ++effect-app.Nbuild metadata; bump N inetscheckerhooks/init.go)._tools/cut-release.sh(pnpm release:cut): builds all platform binaries, packages thetsgo-<platform>[.exe].gzassetsinstall-patched-compilers.mjsdownloads, writesSHA256SUMS, creates the release; version derived from source.--dry-run/--skip-setup.tsgoRepo: effect-app/tsgo,@latest).tsgobuilds; macs/scannerpnpm check+pnpm lint --type-aware(api + e2e + frontend) 0 errors; struct & class facades emit staticType/Encoded/Make/Fieldsinterfaces; 0 remainingEnhancedClass.🤖 Generated with Claude Code