Type predicate functions withMatcher type The problem with discriminating unions Intersection and return types typing rootstate typing third party libraries typing saga