You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This test case is currently commented out because it fails at ark/type/__tests__/narrow.test.ts:115
it("narrows the output type of an morph within a single type",()=>{constt=type("string").pipe((s)=>`${s}!`).narrow((s): s is "foo!"=>s==="foo!");attest<Type<(In: string)=>Out<of<"foo!",Narrowed>>>>(t);});
It is actually inferred as:
typeActual=Type<of<"foo!",Narrowed>
Because includesMorphs in ark/schema/roots/morph.ts can't identify a morph within a single type.
To resolve this issue, includesMorphs would likely have to recurse directly to find a morph AST, or _distill would need to return a context of some sort that includes the distilled type as well as other info like whether a morph was encountered.
This change could be expensive in terms of static perf, so benchmarks should be run to ensure the cost is acceptable.
The text was updated successfully, but these errors were encountered:
This test case is currently commented out because it fails at
ark/type/__tests__/narrow.test.ts:115
It is actually inferred as:
Because
includesMorphs
inark/schema/roots/morph.ts
can't identify a morph within a single type.To resolve this issue,
includesMorphs
would likely have to recurse directly to find a morph AST, or_distill
would need to return a context of some sort that includes the distilled type as well as other info like whether a morph was encountered.This change could be expensive in terms of static perf, so benchmarks should be run to ensure the cost is acceptable.
The text was updated successfully, but these errors were encountered: