[Typescript] TypeScript module Augmentation

You might have some changes locally for 3rd party library.

For the local implementation, you need to modify the types in order to resolve IDE issue.

 

When merging declarations, the specified module path must exactly match the path to the actual module.

 

Example:

declare module 'rxjs/internal/Observable' {
    export interface Observable<T> {
        safeSubscribe<T>(this: Observable<T>, component: BaseComponent,
            next?: (value: T) => void, error?: (error: T) => void, complete?: () => void): Subscription;
    }
}

 

posted @ 2022-10-25 00:09  Zhentiw  阅读(20)  评论(0编辑  收藏  举报