UNPKG

native-fn

Version:
28 lines (27 loc) 1.8 kB
import { PluginNotExtendedError } from "../errors/plugin-not-extended-error"; export declare interface NativePlugins { } export declare interface NativeConstants extends Record<string, any> { } export declare interface NativeErrors extends Record<string, ErrorConstructor> { PluginNotExtendedError: typeof PluginNotExtendedError; } export 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; } export 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>; export 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; export type NativeInstance = NativeBase<NativePlugins, NativeConstants, NativeErrors>;