`types` are not exported by default from `utils` folder

I have a few types in a validation file inside the utils folder. The schemas that I exported are auto-imported but the types are not. How do i declare types globally? here is a snapshot of the validation.ts file:
import { object, string, number, date, boolean, InferType } from "yup";

export const PaymentSchema = object({
paymentMethod: string().oneOf(["Direct Payment", "Bank Transfer"]).required("Select a method"),
transactionId: string().min(3).required("Enter the receipt ID"),
});
// This is not auto-imported in any file
export type TPayment = InferType<typeof PaymentSchema>;
import { object, string, number, date, boolean, InferType } from "yup";

export const PaymentSchema = object({
paymentMethod: string().oneOf(["Direct Payment", "Bank Transfer"]).required("Select a method"),
transactionId: string().min(3).required("Enter the receipt ID"),
});
// This is not auto-imported in any file
export type TPayment = InferType<typeof PaymentSchema>;
Thanks for the help.
2 Replies
Fabian B.
Fabian B.2y ago
Types currently aren't auto imported, you have to import them directly from this file where you want to use it.
baybreezy
baybreezyOP2y ago
Thanks @Fabian B.

Did you find this page helpful?