My doubt is how to override a type definition provided by a third party package (in my case @mui) using only d.ts file
USE CASE:
I want to indicate for all Button Components that the id prop is required, so any dev that use any Button will know that needs to provide an Id
I have tried a file *d.ts with something like this:
declare module '@mui/material/ButtonBase' {
interface ExtendButtonBaseTypeMap<M extends OverridableTypeMap> {
props: { id: string }
defaultComponent: M['defaultComponent']
}
}
but did not work :(
For chakra-ui I know that this works:
declare module React {
interface ButtonHTMLAttributes {
id: string
}
}