Repository navigation
fix(generator): emit an unknown record for field-less case classes - #96
Merged
Merged
Conversation
jleider
added this pull request to stack #97
October 5, 2026 19:54
…asses
- Field-less, non-generic case classes outside a union render as `Readonly<Record<string, unknown>>` with a `t.readonly(t.UnknownRecord)` codec instead of `{}` / `t.type({})`
- Adds `EmptyInterfaceTest` pinning the output
jleider
force-pushed
the
fix/empty-case-class-unknown-record
branch
from
October 6, 2026 17:06
32537b1 to
fbc0c0b
Compare
jleider
marked this pull request as ready for review
October 6, 2026 17:07
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.
Depends on #95.
Field-less, non-generic case classes outside a union render as an open record instead of
{}. typescript-eslint's@typescript-eslint/no-generated-empty-object-typerejects types that resolve to{}, andt.UnknownRecorddecodes exactly whatt.type({})did (any non-array object, extra keys kept).Before:
After:
TsGeneratorclassifies an interface asUnknownRecordorFields(privateInterfaceShapeADT) and renders the codec type, value type and codec from that.TsImports.AvailablegainsiotsUnknownRecordandiotsUnknownRecordC.EmptyInterfaceTestpins the output for a field-less case class and a case class that references it.scala-ts-generationandio-tsskills document the new mapping.Main.scalapost-processing override once this is released.