Skip to content

New error: type not assignable #37572

Closed
@amcasey

Description

@amcasey

https://github.com/jupyter-widgets/ipywidgets/blob/b91a6d9844d1e4e2571f1e7d2fa5416abf468106/packages/base/src/utils.ts#L70

src/utils.ts:70:7 - error TS2322: Type 'awaited V' is not assignable to type 'V'.
  'V' could be instantiated with an arbitrary type which could be unrelated to 'awaited V'.

70       d[keys[i]] = v[i];
         ~~~~~~~~~~

https://github.com/jupyter-widgets/ipywidgets/blob/b91a6d9844d1e4e2571f1e7d2fa5416abf468106/packages/base/src/viewlist.ts#L83

src/viewlist.ts:83:5 - error TS2322: Type 'Promise<(awaited T)[]>' is not assignable to type 'Promise<T[]>'.
  Types of property 'then' are incompatible.
    Type '<TResult1 = (awaited T)[], TResult2 = never>(onfulfilled?: ((value: (awaited T)[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined) => Promise<...>' is not assignable to type '<TResult1 = T[], TResult2 = never>(onfulfilled?: ((value: T[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<...>'.
      Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
        Types of parameters 'value' and 'value' are incompatible.
          Type '(awaited T)[]' is not assignable to type 'T[]'.

83     return Promise.all(this.views);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To repro:

  1. yarn
  2. tsc -b -f packages/base

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions