I have types defined and being used across my project but i am not getting the type safety in this vitest file. I am in a monorepo setup
// zod schemas
export const selectSignupNewTeam = z.object({
account: selectAccountSchema,
team: selectTeamSchema,
user: selectUsersSchema,
})
export type SignUpNewTeam = z.infer<typeof selectSignupNewTeam>
export async function mockNewOrExistingTeamPayload(
db: Db,
teamId?: string,
): Promise<SignUpNewTeam> {
return await db.transaction(async tx => {
...
return { account, team, user }
})
}
Also when i do
const accountData: SignUpNewTeam =
await mockNewOrExistingTeamPayload(db)
i get
(alias) type SignUpNewTeam = {
[x: string]: any;
account?: any;
team?: any;
user?: any;
}
import SignUpNewTeam
Seems like my types get lost