How to override DataParser methods?
DataParser exposes an override system that lets you add or replace instance methods or properties without forking the library.
Implementation example
Steps
- Extend the
DataParserinterface viadeclare moduleso TypeScript knows your API (parseOrThrowin the example). - Define the method with
dataParserInit.overrideHandler.setMethod(...)while reusing existing methods (parser.parse,parser.asyncParse, etc.). - Use the plugin: once the method is registered, all your parsers (
DP.*,DPE.*) share it at runtime.
See also
Recover– To intercept errors on the user side without a global override.
