You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
1.0 KiB

4 months ago
  1. import type { DevtoolsPluginApi } from './api/index.js';
  2. import type { ExtractSettingsTypes, PluginDescriptor, PluginSettingsItem } from './plugin.js';
  3. export * from './api/index.js';
  4. export * from './plugin.js';
  5. export * from './time.js';
  6. export { PluginQueueItem } from './env.js';
  7. type Cast<A, B> = A extends B ? A : B;
  8. type Narrowable = string | number | bigint | boolean;
  9. type Narrow<A> = Cast<A, [] | (A extends Narrowable ? A : never) | ({
  10. [K in keyof A]: Narrow<A[K]>;
  11. })>;
  12. type Exact<C, T> = {
  13. [K in keyof C]: K extends keyof T ? T[K] : never;
  14. };
  15. export type SetupFunction<TSettings = any> = (api: DevtoolsPluginApi<TSettings>) => void;
  16. export declare function setupDevtoolsPlugin<TDescriptor extends Exact<TDescriptor, PluginDescriptor>, TSettings = ExtractSettingsTypes<TDescriptor extends {
  17. settings: infer S;
  18. } ? S extends Record<string, PluginSettingsItem> ? S : Record<string, PluginSettingsItem> : Record<string, PluginSettingsItem>>>(pluginDescriptor: Narrow<TDescriptor>, setupFn: SetupFunction<TSettings>): void;