Type 'distillOut<T>' is not assignable to type 'T'.
This produces error:
If I cast, then it works:
Why is the casting necessary? Shouldn't it be type
T
after checking it's not type.errors
?18 Replies
T may be
(v: Foo) => Bar
i.e. a morph
Also check Type<Foo>.allows
, it doesn't morph iircIt should also be
: Type<T>["infer"]
iirc. Type<T>
doesn't validate to type T
because of constraintsType<T>['infer']
But if I do do a morph, shouldn't that be captured by
T
? Example:
In this case, shouldn't it evaluate to:
?I would say, just don't do the return type
Let it infer itself
Also, isn't your function just
type().assert
?Ok yes this works
Or you remap the error?
@SynthLuvr
@SynthLuvr
@SynthLuvr since you don't seem to be aware,
t.assert(...)
is equivalent to
Err except I think it throws AggregateError
instead of Error
I think that's unrelated and off topic though
Will try with this
The point is that your function seems to just be duplicating the built-in
assert
that already existsOkay
so,
Bacause this
Ok but that's still off topic. I'm specifically asking about the type, not about about built-in functions. Appreciate the help though