Typescript d.ts file

Viewed 85

I trying to understand why I getting error while importing elements from MUI library, after comment import createTheme inside d.ts file? On the other side if I change extension to .ts with also commented import, but export empty object then everything works.

expanded-theme.d.ts

// import { createTheme } from '@mui/material/styles';

declare module '@mui/material/styles' {
    interface Palette {
        play: Palette['primary'];
        moreInfo: Palette['primary'];
    }
    interface PaletteOptions {
        play: PaletteOptions['primary'];
        moreInfo: PaletteOptions['primary'];
    }
  }

declare module "@mui/material" {
    interface ButtonPropsColorOverrides {
        play: true;
        moreInfo: true;
    }
}

Errors from other files:

Module '"@mui/material/styles"' has no exported member 'createTheme'.
Module '"@mui/material"' has no exported member 'FormControl'.
Module '"@mui/material"' has no exported member 'Button'.
...

Changed extension to expanded-theme.ts (no errors):

// import { createTheme } from '@mui/material/styles';

declare module '@mui/material/styles' {
    interface Palette {
        play: Palette['primary'];
        moreInfo: Palette['primary'];
    }
    interface PaletteOptions {
        play: PaletteOptions['primary'];
        moreInfo: PaletteOptions['primary'];
    }
  }

declare module "@mui/material" {
    interface ButtonPropsColorOverrides {
        play: true;
        moreInfo: true;
    }
}

export {}
0 Answers
Related