Usage of createResource and correct access to the result
I'm not really sure why latest can be undefined here. Am I missing something or is it TS being TS?
![No description](https://cdn.answeroverflow.com/1182157479795236894/image.png)
2 Replies
Because until the promise resolves, the value is undefined
The resource needs to have some value in the meantime, after all
Although you are using a Show, it's impossible to tell TS that the return type of a function can be narrowed
So I guess you could say this is a ts problem
You could try to use the callback version of Show, that should let narrow the type by passing the value as the callback param
Argh! So annoying 😢