UNPKG

native-fn

Version:
41 lines (37 loc) 2.35 kB
declare const PluginNotExtendedError: ErrorConstructor; declare interface NativePlugins { } declare interface NativeConstants extends Record<string, any> { } declare interface NativeErrors extends Record<string, ErrorConstructor> { PluginNotExtendedError: typeof PluginNotExtendedError; } declare interface NativePlugin<Key extends string, Module, Constants extends Record<string, any> = Record<string, any>, Errors extends Record<string, ErrorConstructor> = Record<string, ErrorConstructor>> { installed: boolean; name: Key; module: Module; Constants: Constants; Errors: Errors; } declare type ExtendedNativeBase<Key extends string, Module, Constants extends Record<string, any> = Record<string, any>, Errors extends Record<string, ErrorConstructor> = Record<string, ErrorConstructor>> = NativeBase<NativePlugins & { [Plugin in Key]: Module; }, NativeConstants & Constants, NativeErrors & Errors>; declare type NativeBase<Plugins, AssignedConstants extends Record<string, any> = Record<string, any>, AssignedErrors extends Record<string, ErrorConstructor> = Record<string, ErrorConstructor>> = { Version: string; Constants: AssignedConstants; Errors: AssignedErrors; extends: <Key extends string, Module, Constants extends Record<string, any> = Record<string, any>, Errors extends Record<string, ErrorConstructor> = Record<string, ErrorConstructor>>(this: NativeBase<Plugins, AssignedConstants, AssignedErrors>, plugin: NativePlugin<Key, Module, Constants, Errors>) => NativeBase<Plugins & { [Plugin in Key]: Module; }, AssignedConstants & Constants, AssignedErrors & Errors>; } & NativePlugins; type NativeInstance = NativeBase<NativePlugins, NativeConstants, NativeErrors>; declare const Native: { Version: string; Constants: {}; Errors: { PluginNotExtendedError: ErrorConstructor; }; extends<Key extends string, Module, Constants extends Record<string, any> = Record<string, any>, Errors extends Record<string, ErrorConstructor> = Record<string, ErrorConstructor>>(this: NativeBase<any, any, any>, plugin: NativePlugin<Key, Module, Constants, Errors>): ExtendedNativeBase<Key, Module, Constants, Errors>; }; export { Native as default }; export type { ExtendedNativeBase, NativeBase, NativeConstants, NativeErrors, NativeInstance, NativePlugin, NativePlugins };