Skip to content

Infer any as morph return #1023

Closed
Closed

Description

@ssalbdivad
const t = type("string", "=>", (s) => s as any);
// currently this fails because it is inferred as `(In: string) => any`
attest<any>(t.infer);

This is due to the way morphs are extracted in distill while trying to preserve named types inferred from e.g. instanceof.

If we can fix this without significant type performance costs, we should. That said, who wants to return any from their morphs anyways?

Activity

  1. moved this from To do to Backlog in arktypeioon Jun 23, 2024
  2. added 4 commits that reference this issue on Oct 13, 2026
  3. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    MemberAuthor

    Fixed in 3.0.0-beta.0 (#1728). Try it with npm i arktype@next.

  4. moved this from Backlog to Done (merged or closed) in arktypeioon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done (merged or closed)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions