Get type of `beforeLoad` options
Sometimes we find that we have some beforeLoad functions that do a lot of work, and to keep our route files clean, we like to abstract these out into separate files when they reach significant length.
Historically, we had made a type called
Which we can then type our options as. This "works" until we go to upgrade the router, and every time some internal type change breaks it and we spend a while looking into what we can do to get the types working again.
I understand that types do not follow semver, so I accept that this is going to happen, but I'm just wondering if there is a suggested approach for getting the options for a given route? Or at least a type that is less likely to break across versions?
Historically, we had made a type called
GetOptionTypeFromRouteId which we could call something like:Which we can then type our options as. This "works" until we go to upgrade the router, and every time some internal type change breaks it and we spend a while looking into what we can do to get the types working again.
I understand that types do not follow semver, so I accept that this is going to happen, but I'm just wondering if there is a suggested approach for getting the options for a given route? Or at least a type that is less likely to break across versions?