you aren't expanding the union
-
Can you elaborate on what this means?
-
I see the difference but I don't understand why you had to do that. Is there a place in the handbook that explains?
-
Before you answered I read the documentation and thought the reason it wasn't working was because:
When every type in a union contains a common property with literal types, TypeScript considers that to be a discriminated union, and can narrow out the members of the union.
source: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
I thought the issue was one of these things I've bolded:
I don't have a type AllSaves = a | b | c anywhere.
And my version numbers aren't literal. But maybe since I'm using an as const array for the version numbers, it counts as literal types?