How to turn a string into class in typescript?

I have a class CustomError defined like so;

import IError from "../interfaces/IError";
import { StatusCodes } from "http-status-codes";

export default class CustomError implements IError {
      constructor(
            public message: string = "Something went wrong",
            public status_code: number = StatusCodes.INTERNAL_SERVER_ERROR,
            public name: string = "internal_error",
            public render?: boolean,
            public stack?: string | undefined
      ) {}
}

and an enum Err defined as follow;

enum Err {
      unauthorized = "UnauthorizedError",
      custom = "CustomError",
      notFound = "NotFoundError",
      badRequest = "BadRequestError",
}

how can i turn Err.custom for example into the class CustomError.