#Typescript seems to know what a type is but wont actually use it

7 messages · Page 1 of 1 (latest)

ornate zinc
#

I can't really post the whole code sample because it's huge but I'm really confused as to why this is a problem

In the below we see row is correctly inferred

#

But the return type of getLatestData is wrong

#

If you give row literally any type wrong or otherwise suddenly getLatestData resolves it's types

#

Why does this sort of thing happen?
I've seen this sort of thing I think in react-query types but I don't know how to look for a resolution to this

desert hollow
#

You need to make a reproduction on TS playground. We can't debug thin air.

ornate zinc
#

I know. And usually I do. But this is a huge hunk of application specific code that I haven’t been able to meaningfully simplify for a playground.

I was mostly banking on finding out what this type of issue is and where I can look more into it.

It seemed pretty unique that you need to give a type, any type, including the wrong one to get the rest of the types to work

#

But yeah I’m more looking for resources on this sort of issue rather than a specific fix