Hi all,
I’ve decided to throw caution to the wind and go full on strict TS mode, in the hope that if I can make it through the pain it’ll be easier on the other side!
My latest issue is how to type the returned object from a success cell. I’ve tried using the query type, e.g.:
FindCategoryById['category']
but this includes the null/undefined possibilities as well:
{
__typename?: "Category" | undefined;
id: number;
name: string;
parentCategoryId?: number | null | undefined;
childCategories?: {
...;
}[] | null | undefined;
} | null | undefined
Just wondering if there was any way to say that there is definitely going to be an object returned, as it’s in the success component (rather than error or empty)?
I’d also be interested to know if there are any RW-specific resources for getting up and running with TS strict - maybe an example project? I use TS in my other projects but there’s a decent amount of additional complexity here with the Apollo and RW layers. I’ve had a hunt around here/Discord but haven’t seen many conversations about it. The docs have this page - https://redwoodjs.com/docs/typescript/strict-mode.- which is useful but doesn’t cover all of my issues!
Thanks!