I'm using declaration: true
as part of my TypeScript configuration. It generates the correct types for this component, but I wanted to overwrite it. How would I go about doing that?
// Button.tsx
export const Button: React.FC<{
className: string;
text: string
}> = ({ className, text }) => (
<button class={className}>
{text}
</button>
)
What I've already tried was to place an adjacent index.d.ts
file in this directory. I thought because of how definition files were resoluted, it would overwrite the export from Button.tsx
:
// index.d.ts
export { default } from "./Button";
It references this type definition that I have in this folder as well:
// Button.d.ts
declare const Button: any;
export default Button;
However, this does not work. Instead, I get the types that I defined from Button.tsx
- how can I overwrite this type myself?