javascript: Compilation breaks on Typescript 4.8.2, Ubuntu 20.04

When running tsc, it breaks with the following errors:

root@ec42f57e3eda:/mirrord/vscode-ext# tsc
node_modules/@kubernetes/client-node/dist/informer.d.ts:19:41 - error TS2344: Type 'T' does not satisfy the constraint 'KubernetesObject'.

19     on(verb: string, fn: ObjectCallback<T>): void;
                                           ~

  node_modules/@kubernetes/client-node/dist/informer.d.ts:18:27
    18 export interface Informer<T> {
                                 ~
    This type parameter might need an `extends KubernetesObject` constraint.

node_modules/@kubernetes/client-node/dist/informer.d.ts:20:42 - error TS2344: Type 'T' does not satisfy the constraint 'KubernetesObject'.

20     off(verb: string, fn: ObjectCallback<T>): void;
                                            ~

  node_modules/@kubernetes/client-node/dist/informer.d.ts:18:27
    18 export interface Informer<T> {
                                 ~
    This type parameter might need an `extends KubernetesObject` constraint.

node_modules/@kubernetes/client-node/dist/informer.d.ts:24:106 - error TS2344: Type 'T' does not satisfy the constraint 'KubernetesObject'.

24 export declare function makeInformer<T>(kubeconfig: KubeConfig, path: string, listPromiseFn: ListPromise<T>, labelSelector?: string): Informer<T>;
                                                                                                            ~

  node_modules/@kubernetes/client-node/dist/informer.d.ts:24:38
    24 export declare function makeInformer<T>(kubeconfig: KubeConfig, path: string, listPromiseFn: ListPromise<T>, labelSelector?: string): Informer<T>;
                                            ~
    This type parameter might need an `extends KubernetesObject` constraint.


Found 3 errors in the same file, starting at: node_modules/@kubernetes/client-node/dist/informer.d.ts:19 

** Client Version ** 0.16.3

** Server Version ** N/A

To Reproduce Steps to reproduce the behavior: Run tsc on Ubuntu 20.04 with TypeScript 4.8.2

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • NodeJS Version 12.22.9

Additional context

You can view the error in a wider context in our CI logs.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (16 by maintainers)

Most upvoted comments

@ipsi Somehow the changed got merged, but never released. See the comments in https://github.com/kubernetes-client/javascript/pull/897

@brendandburns I put together a minial example here https://github.com/JarnoRFB/kube-typerror. Let me know if this helps. The error is there even though node_modules is excluded and esModuleInterop is turned on. Only skipLibCheck helps, but that turns off the checking of all libs, as was already mentioned.

Another option is to simply add exclude: [ "node_modules" ] to your tsconfig.json

Same error for me on Ubuntu 22.04 with Typescript 4.8.3.

Closing this issue, since it is fixed. I will look into the devDependencies issue separately.

@brendanburns / @brendandburns any chance you release a new version to resolve this issue?