Modify module with plugins when Typescript definition split across multiple files -
in typescript 2.2 i'm trying define module (hapijs) has various plugin options.
i refactored core code multiple .d.ts files , imported , re-exported them index.d.ts using following pattern (as seen here):
export * './hapi/connection'; export * './hapi/reply'; export * './hapi/request'; export * './hapi/response'; export * './hapi/route'; export * './hapi/server_views'; export * './hapi/server';
in separate module, extends them as seen here:
import * hapi 'hapi'; declare module 'hapi' { interface ifilehandler { /** path - path string or function described above (required). */ path: string | irequesthandler<string>; ... } // extending hapi core: interface irouteconfiguration { file?: string | irequesthandler<string> | ifilehandler;
however when did references irequesthandler
above error with: "cannot find name 'irequesthandler'.". if hapi code moved 1 giant index.d.ts works expected. there way achieve using multiple hapi definition files?
i haven't tried out perhaps might possible use following (though doubt interface hapi.irouteconfiguration {
acceptable):
import * hapi 'hapi'; declare module 'hapi' { interface ifilehandler { /** path - path string or function described above (required). */ path: string | hapi.irequesthandler<string>; ... } // extending hapi core: interface hapi.irouteconfiguration { file?: string | hapi.irequesthandler<string> | ifilehandler;';
alternatively perhaps importing hapi/server
, or whichever part needed.
Comments
Post a Comment