function dependsOnParameter<B extends boolean>(x: B): B extends true ? number : string { if (x) { return 3 as any; } else { return "string"as any; } }