'Override variable type from external library
I am using a third party library for my react application. There are some incorrect/outdated types.
Let's say the library has the following type declarations:
declare const Hello: (name: string) => void
export interface SomeInterface {
property1: string
property2: number
}
Let's assume both of these types are incorrect and I need to override them:
import 'external-lib'
declare module 'external-lib'{
export interface SomeInterface {
property1: boolean
property2: boolean
}
export declare const Hello: (name: string, age: number) => void
}
So I redeclared the interface to have boolean properties and Hello function to accept the age parameter. (This is correct implementation of the library).
My problem is, that while interface Someinterface is overridden by me properly, the function Hello still uses the internal library type.
Is there a way to override function type declaration from external library?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
