Passing an exported scope to a function (Type 'string' is not assignable to type 'never')
Hello, I have an exported scope that I'm trying to pass to a generic class to be used.
I see that
.export()
yields type Module
, but I couldn't figure out how to use that either.
Appreciate any help7 Replies
Try using
type.Any<TData>
for schema.
Some change recently seems to have made generics with vanilla Type
less cooperative as a base constraint:
https://discord.com/channels/957797212103016458/1302682752818352249/1306075236755570728
I'll see if I can easily address that but if not type.Any
is a more accurate base type anyways since it allows you to pass a type from a scopewow awesome that was easy, thanks so much, spent a crazy amount of time trying to figure it out on my own lol
edited the title so hopefully anyone else with that error can find
Yeah it's really weird honestly, basically under the hood
Type
is a conditional that gets additional methods/props based on what kind of type it is.
But all branches evaluate to BaseType
plus those extra methods, and that would work in most cases as a base type in the past
Hmm, I guess it might have just been the NoInfer
stuff I added to make .map
work better. @Andarist Did you have any luck with that NoInfer
repro?
Unfortunately I kind of need that to work around another case where TS behaves very weirdly 😛
(I mean I need the NoInfer
logic to stay somehow, not that you have to fix anything in TS for me haha)Ahh okay all good that kinda makes sense 😂
I was refactoring some code while doing this and realizing I actually have the wrong type, gonna make a new thread for this other issue..
Not yet, i have it on my todo list (aka somewhere in my tabs)
Oh so I nerdsniped you back into this haha
Would love to find a workaround here now that it's affected a few people externally
I'll mess around a bit more based on what you said.
not sure, haha - i got to the
NoInfer
issue from the other thread
i thought i was replying to it, actually