Syntax to correctly augment a type from a library

Viewed 208

I am trying to replace the defintion of one type in a library which comes with type defintions. I tried various options such as:

// untyped.d.ts
declare module "emotion" {
    export const css: (...args: DR<Array<Interpolation>>) => string
}

Unfortunatly it doesn't work. Either removes other types of the library, or isn't recognized. What is the proper way to augment a library in a d.ts customized file?

1 Answers

you need to import the module before otherwise you replace the complete definition.

import "emotion"

declare module "emotion" {
    interface css{
         (...args: DR<Array<Interpolation>>): string
    }
}
Related