Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
.narrow(...).in doesn't return the original type - arktype
a
arktype
•
12mo ago
•
3 replies
Tehrin
.narrow(...).in doesn't return the original type
Example
:
https://arktype.io/playground?code=import%2520%257B%2520type%2520%257D%2520from%2520%2522arktype%2522%250A%250Aconst%2520Thing%2520%253D%2520type%28%257B%250A%2509a%253A%2520%2522string%2522%252C%250A%2520%2520%2520%2520b%253A%2520%2522string%2522%250A%257D%29.narrow%28%28obj%252C%2520ctx%29%2520%253D%253E%2520%257B%250A%2520%2520%2520%2520if%2520%28obj.a%2520%21%253D%2520obj.b%29%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520return%2520ctx.reject%28%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520problem%253A%2520%2522Mismatch%2522%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520path%253A%2520%255B%2522b%2522%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%29%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520return%2520true%253B%250A%257D%29%253B%250A%250Aconst%2520out%2520%253D%2520Thing%28%257B%250A%2520%2520%2520%2520a%253A%2520%2522Hello%2522%252C%250A%2520%2520%2520%2520b%253A%2520%2522Hi%2522%252C%250A%257D%29%250A
I
'm mostly looking at
.in
.in
to be able to call
.toJsonSchema
.toJsonSchema
For the moment I
'm using
.pipe
.pipe
but this sounds like a bug
ArkType
ArkType Playground
TypeScript
's
1
:1 validator
, optimized from editor to runtime
arktype
Join
This is a friendly space centered around ArkType, TypeScript's 1:1 validator (https://github.com/arktypeio/arktype)
860
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Was this page helpful?
Yes
No
Similar Threads
Recent Announcements
Similar Threads
type narrow issue on result
a
arktype / questions
12mo ago
morph then narrow with an existing type?
a
arktype / questions
3y ago