Currently facing a challenge where I need to update a global type. Specifically, I am looking to modify the signature of the Element.prototype.animate
function to make it optional.
This is the approach I attempted:
declare global {
interface Element {
animate?: Animatable['animate'];
}
}
However, this resulted in the following TypeScript (TS) error:
Interface 'Element' incorrectly extends interface 'Animatable'.
Types of property 'animate' are incompatible.
Type '((keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined) => Animation) | undefined' is not assignable to type '(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined) => Animation'.
Type 'undefined' is not assignable to type '(keyframes: PropertyIndexedKeyframes | Keyframe[] | null, options?: number | KeyframeAnimationOptions | undefined) => Animation'.
Is there a way to resolve this issue without disabling any TS checks?