Typescript - How to override declaration in lib.d.ts

Is there a way to override the var declaration in the d.ts file?

initTaggingControls() { RTE.CanvasEvents.registerListener(RTE.CanvasEvents.editableRegionChangedEvent, Function.createDelegate(null, this.onCustomTextChanged)); RTE.CanvasEvents.registerListener(RTE.CanvasEvents.editableRegionBlurEvent, Function.createDelegate(null, this.onCustomTextChanged)); RTE.CanvasEvents.registerListener(RTE.CanvasEvents.editableRegionFocusEvent, Function.createDelegate(null, this.onCustomTextChanged)); } 

RTE is part of SharePoint. declare var RTE: any; does the trick. The problem is Function.createDelegate , because I cannot declare or redo it.

Function var is already declared in lib.d.ts. Is there a way to override the var declaration to add custom methods?

Function.createDelegate is part of the Microsoft ajax Library.

+4
source share
1 answer

I'm afraid not. For example, the following error message:

 declare var String: any; 

You can add only interfaces / modules. Variable definitions are closed.

I have a work item regarding the same: https://typescript.codeplex.com/workitem/917

+1
source

Source: https://habr.com/ru/post/1487147/


All Articles