DEV Community

Discussion on: Template String Types as Discriminants in Typescript 4.5

Collapse
 
scooperdev profile image
Stephen Cooper

In the final example I guess the following would also work as a use case that gets correctly discriminated. This is such a powerful feature!

if(response.status === "301") {
        console.log(response.redirect);
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mainawycliffe profile image
Maina Wycliffe

Yeah, that would work as well