Skip to content

Commit

Permalink
feat: preserve name of inferred class when not including morphs (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalbdivad authored Oct 12, 2023
1 parent ae62b5d commit 647a9a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions dev/configs/.changeset/chilly-jeans-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"arktype": patch
---

Preserve named classes not including morphs
4 changes: 2 additions & 2 deletions src/scopes/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ export type AnonymousTypeName = `λ${string}`
export const isAnonymousName = (name: string): name is AnonymousTypeName =>
name[0] === "λ"

export type asIn<t> = asIo<t, "in">
export type asIn<t> = asIo<t, "in"> extends t ? t : asIo<t, "in">

export type asOut<t> = asIo<t, "out">
export type asOut<t> = asIo<t, "out"> extends t ? t : asIo<t, "out">

type asIo<t, io extends "in" | "out"> = t extends ParsedMorph<infer i, infer o>
? io extends "in"
Expand Down

0 comments on commit 647a9a9

Please sign in to comment.