Skip to content

BUG: npm run tsc fails with 20+ TypeScript errors #70

@alronova

Description

@alronova

Description

Running npm run tsc fails with 24 TypeScript errors across 10 files, caused by a combination of a broken types entry point in @kinvolk/headlamp-plugin@0.11.4, MUI version conflicts introduced by transitive dependencies, stale import paths, and several minor type annotation gaps in the source code.

Impact

Contributors cannot type-check the codebase during development, making it impossible to verify type correctness before submitting changes.

Environment and steps to reproduce

  • Cloned the repository
  • Run npm install
  • Run npm run tsc
  • You will encounter errors: TypeScript compilation fails with 24 errors across 10 files

Expected behavior

npm run tsc should complete with zero errors, allowing contributors to verify type correctness during development.

Additional information

Full error log:

> inspektor-gadget@0.1.0-beta.3 tsc
> headlamp-plugin tsc

".": tsc-ing, :node_modules/.bin/tsc --noEmit:...
src/common/NodeSelection/index.tsx(2,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/common/gadgetbackgroundinstanceform.tsx(2,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/gadgets/backgroundgadgets.tsx(9,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/gadgets/backgroundgadgets.tsx(93,11): error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string'.
src/gadgets/backgroundgadgets.tsx(172,9): error TS2322: Type '{ open: boolean; title: string; description: string; onConfirm: () => void; handleClose: () => void; }' is not assignable to type 'IntrinsicAttributes & ConfirmDialogProps'.
  Property 'open' does not exist on type 'IntrinsicAttributes & ConfirmDialogProps'.
src/gadgets/gadgetDetails.tsx(2,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/gadgets/gadgetDetails.tsx(273,9): error TS2322: Type '{ open: boolean; handleClose: () => void; title: string; description: string; onConfirm: () => void; }' is not assignable to type 'IntrinsicAttributes & ConfirmDialogProps'.
  Property 'open' does not exist on type 'IntrinsicAttributes & ConfirmDialogProps'.
src/gadgets/gadgetDetails.tsx(295,11): error TS2322: Type '(url?: string | URL, target?: string, features?: string) => Window' is not assignable to type 'boolean'.
src/gadgets/gadgetGrid.tsx(3,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/gadgets/gadgetGrid.tsx(230,15): error TS2322: Type '{ ig: IGConnection; imageName: any; enableEmbed: true; gadgetInfo: any; resource: any; }' is not assignable to type 'IntrinsicAttributes & { resource?: any; gadgetInfo: any; imageName: any; enableEmbed?: boolean; }'.
  Property 'ig' does not exist on type 'IntrinsicAttributes & { resource?: any; gadgetInfo: any; imageName: any; enableEmbed?: boolean; }'.
src/gadgets/gadgetGrid.tsx(593,9): error TS2322: Type '{ gadgetInfo: any; resource: any; ig: IGConnection; imageName: any; }' is not assignable to type 'IntrinsicAttributes & { gadgetInfo: any; resource: any; imageName: any; enableEmbed?: boolean; }'.
  Property 'ig' does not exist on type 'IntrinsicAttributes & { gadgetInfo: any; resource: any; imageName: any; enableEmbed?: boolean; }'.
src/gadgets/helper.ts(70,15): error TS2339: Property 'ddClient' does not exist on type 'Window & typeof globalThis'.
src/gadgets/list.tsx(2,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/gadgets/params/filter.tsx(37,10): error TS2339: Property 'fields' does not exist on type 'unknown'.
src/gadgets/params/filter.tsx(38,33): error TS2339: Property 'name' does not exist on type 'unknown'.
src/gadgets/params/sortingfilter.tsx(20,10): error TS2339: Property 'fields' does not exist on type 'unknown'.
src/gadgets/params/sortingfilter.tsx(21,33): error TS2339: Property 'name' does not exist on type 'unknown'.
src/gadgets/params/sortingfilter.tsx(21,73): error TS2339: Property 'name' does not exist on type 'unknown'.
src/gadgets/params/sortingfilter.tsx(34,31): error TS2339: Property 'map' does not exist on type 'unknown'.
src/gadgets/resourcegadgets.tsx(3,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
src/gadgets/resourcegadgets.tsx(140,9): error TS2322: Type '{ open: boolean; title: string; description: string; onConfirm: () => void; handleClose: () => void; }' is not assignable to type 'IntrinsicAttributes & ConfirmDialogProps'.
  Property 'open' does not exist on type 'IntrinsicAttributes & ConfirmDialogProps'.
src/gadgets/resourcegadgets.tsx(154,37): error TS2339: Property 'length' does not exist on type 'unknown'.
src/gadgets/resourcegadgets.tsx(157,23): error TS2339: Property 'map' does not exist on type 'unknown'.
src/index.tsx(14,17): error TS2307: Cannot find module '@kinvolk/headlamp-plugin/lib/K8s' or its corresponding type declarations.
Problem running tsc inside of "."

Note: the "types": "./lib/additional.d.ts" issue in @kinvolk/headlamp-plugin@0.11.4 affects any plugin using named imports from the package root and should ideally be fixed upstream in the headlamp project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions