'How to override a type of a package globally?

I am trying to override this type that being used in Zod with a custom enum. This is the type exported by Zod:

export type CustomErrorParams = Partial<util.Omit<ZodCustomIssue, "code">>;

I have this declarations to be used globally, but Typescript is not overriding it for me right now. I can confirm that this global.d.ts file is being loaded correctly by my framework.

import type { InvalidCode } from '$lib/types'

declare module "zod" {
    export type CustomErrorParams = InvalidCode
}

How can I override that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source