cli icon indicating copy to clipboard operation
cli copied to clipboard

Typings and documentation issue in custom plugins

Open Karnaukhov-kh opened this issue 1 year ago • 0 comments

What happened?

  1. When trying to feed the table with array of objects it throws typing error. So I need to use as any.

image

  1. When trying to inspect the source code I see next very messy signatures

image

What would you expect to happen?

  1. Objects array just works.
  2. When going to sources, I'd like to see a normal ts-doc style documentation of each field. like Angular does, I.e.
export declare interface Injectable {
    /**
     * Determines which injectors will provide the injectable.
     *
     * - `Type<any>` - associates the injectable with an `@NgModule` or other `InjectorType`. This
     * option is DEPRECATED.
     * - 'null' : Equivalent to `undefined`. The injectable is not provided in any scope automatically
     * and must be added to a `providers` array of an [@NgModule](api/core/NgModule#providers),
     * [@Component](api/core/Directive#providers) or [@Directive](api/core/Directive#providers).
     *
     * The following options specify that this injectable should be provided in one of the following
     * injectors:
     * - 'root' : The application-level injector in most apps.
     * - 'platform' : A special singleton platform injector shared by all
     * applications on the page.
     * - 'any' : Provides a unique instance in each lazy loaded module while all eagerly loaded
     * modules share one instance. This option is DEPRECATED.
     *
     */
    providedIn?: Type<any> | 'root' | 'platform' | 'any' | null;
}

What steps did you take?

  1. Tried to create a custom plugin and fill in the output table with my output array of objects ¯_(ツ)_/¯.

Shape of objects


export interface ElementOutput {
  "Start Date": string;
  "End Date": string;
  app_version: string;
  target_element: string;
  page_group: string;
  p10: number;
  p25: number;
  p50: number;
  p75: number;
  p95: number;
  IQR: string;
  CQV: string;
  Events: number;
  "Events (%)": string;
  "Poor (%)": string;
  "NeedsImprovement (%)": string;
  "Good (%)": string;
}
  const inpAuditOutput: AuditOutput = {
    slug: cruxINPSlug,
    score: +report[report.length - 1]["UX Score"] / 100,
    value: +report[report.length - 1]["UX Points (300 max)"],
    displayValue: displayValue(
      +report[report.length - 1]["UX Points (300 max)"]
    ),
    details: {
      table: {
        title: "Data summary",
        rows: report as any, // here throws
      },
    },
  };

Code PushUp package version

0.50.0

What operation system are you on?

Windows

Node version

18.17.0

Relevant log output

No response

Karnaukhov-kh avatar Sep 30 '24 16:09 Karnaukhov-kh