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
Other context you think may be relevant (JS flavor, OS, etc.):
🧑💻 Repro
This test currently fails because we are not able to infer specialNumber in this context:
it("validated default in scope",()=>{const$=scope({specialNumber: "number",// "5 is not assignable to specialNumber "obj: {foo: "string",bar: "specialNumber = 5"},});});
This is due to this workaround in ark/type/parser/objectLiteral.ts in validateDefaultValueString:
typevalidateDefaultValueString=// other context[// check against the output of the type since morphs will not occur// we currently can't parse string embedded defaults for non-global keywordsdistillOut<inferString<baseDef,{},args>>,// a default value should never have In/Out, so which side we choose is irrelevant// we will never need a scope here as we're just trying to infer a UnitLiteraldistillOut<inferString<defaultDef,{},args>>]extends[infer base, infer defaultValue]
The reason we need to pass {} in the top def instead of $ (which fixes the issue) is that passing $ and then comparing the values breaks other inference, namely thunks and piping (you should see errors across the repo if you change this back to $).
For now the workaround is to just use a tuple default, e.g:
it("validated default in scope",()=>{const$=scope({specialNumber: "number",obj: {foo: "string",bar: ["specialNumber","=",5]},});});
This may not be resolvable without changes to TS, but could be fixed by #1017
The text was updated successfully, but these errors were encountered:
Report a bug
🔎 Search Terms
default value scope alias not assignable literal
🧩 Context
🧑💻 Repro
This test currently fails because we are not able to infer
specialNumber
in this context:This is due to this workaround in
ark/type/parser/objectLiteral.ts
invalidateDefaultValueString
:The reason we need to pass
{}
in the top def instead of$
(which fixes the issue) is that passing$
and then comparing the values breaks other inference, namely thunks and piping (you should see errors across the repo if you change this back to $).For now the workaround is to just use a tuple default, e.g:
This may not be resolvable without changes to TS, but could be fixed by #1017
The text was updated successfully, but these errors were encountered: