I have a type in a shape like this (simplified):
type AllContentType =
| 'application/json'
| 'application/octet-stream'
| 'multipart/form-data';
type myType<T = AllContentType> = {
body: T extends 'multipart/form-data' ? number : string;
otherHeader: T;
};
and it cannot figure out which string has been put into otherHeader, it always returns
const obj: myType = { header: 'multipart/form-data', body: "" };
body as string | number. Any way to get it to figure out what I actually have put in?