This message was deleted.
# typescript
s
This message was deleted.
h
Ok, I was able to work around this by using the
axios
library a little differently
Instead of
Copy code
export const fooResponse = z.object({
		bar: z.string(),
});
export type FooResponse = z.infer<typeof fooResponse>;

export const makeHttpCall = async (
	ax: AxiosInstance,
	name: string,
	baz: string
): Promise<string> => {
	const response = await <http://ax.post|ax.post>(`${somePath}/blah/${name}`, {
		somefield: baz,
	});
	return response.parse(response.data).bar;
};
use the generic form of the call to axios instead
Copy code
export const fooResponse = z.object({
		bar: z.string(),
});
export type FooResponse = z.infer<typeof fooResponse>;

export const makeHttpCall = async (
	ax: AxiosInstance,
	name: string,
	baz: string
): Promise<string> => {
	const response = await <http://ax.post|ax.post><FooResponse>(`${somePath}/blah/${name}`, {
		somefield: baz,
	});
	return response.bar;
};
Anyone know a workaround when there's not an alternative like above? e.g. calling
crypto.randomInt
?