Module

Introduction

  • To declare the type for module that can be used for importing into other file, such as library

Example

// set the default export of module
declare module "*.png" {
  const src: string;
  export default src;
}

// country-code-list is any type
declare module "country-codes-list" {
}

import { Theme as MuiTheme } from "@mui/material";

// extend the library type
declare module "@emotion/react" {
  export interface Theme extends MuiTheme {}
}

Last updated

Was this helpful?