jupyterlab / extension-examples

JupyterLab Extensions by Examples
BSD 3-Clause "New" or "Revised" License
439 stars 167 forks source link

ExampleDocWidget is not incompatible with IModel #220

Closed Max-ChenFei closed 1 year ago

Max-ChenFei commented 1 year ago

Description

Type ExampleDocModel does not satisfy the constraint IModel

src/factory.ts(15,3): error TS2344: Type 'ExampleDocWidget' does not satisfy the constraint 'IDocumentWidget<Widget, IModel>'.
  Types of property 'context' are incompatible.
    Type 'IContext<ExampleDocModel>' is not assignable to type 'IContext<IModel>'.
      Type 'ExampleDocModel' is not assignable to type 'IModel'.
src/factory.ts(34,40): error TS2344: Type 'ExampleDocModel' does not satisfy the constraint 'IModel'.
src/factory.ts(47,45): error TS2344: Type 'ExampleDocModel' does not satisfy the constraint 'IModel'.
src/index.ts(67,38): error TS2345: Argument of type 'ExampleWidgetFactory' is not assignable to parameter of type 'WidgetFactory'.
  Types of property 'widgetCreated' are incompatible.
    Type 'ISignal<IWidgetFactory<ExampleDocWidget, ExampleDocModel>, ExampleDocWidget>' is not assignable to type 'ISignal<IWidgetFactory<IDocumentWidget<Widget, IModel>, IModel>, IDocumentWidget<Widget, IModel>>'.
      Type 'IWidgetFactory<ExampleDocWidget, ExampleDocModel>' is not assignable to type 'IWidgetFactory<IDocumentWidget<Widget, IModel>, IModel>'.
        Type 'ExampleDocWidget' is not assignable to type 'IDocumentWidget<Widget, IModel>'.
src/index.ts(71,37): error TS2345: Argument of type 'ExampleDocModelFactory' is not assignable to parameter of type 'ModelFactory'.
  The types returned by 'createNew(...)' are incompatible between these types.
    Type 'ExampleDocModel' is not assignable to type 'IModel'.
src/model.ts(144,12): error TS2416: Property 'sharedModel' in type 'ExampleDocModel' is not assignable to the same property in base type 'IModel'.
  Type 'ExampleDoc' is missing the following properties from type 'ISharedDocument': state, getState, setState
src/widget.tsx(30,3): error TS2344: Type 'ExampleDocModel' does not satisfy the constraint 'IModel'.
  Types of property 'sharedModel' are incompatible.
    Type 'ExampleDoc' is not assignable to type 'ISharedDocument'.
src/widget.tsx(32,62): error TS2344: Type 'ExampleDocModel' does not satisfy the constraint 'IModel'.
src/widget.tsx(54,50): error TS2344: Type 'ExampleDocModel' does not satisfy the constraint 'IModel'.
src/widget.tsx(237,47): error TS2344: Type 'ExampleDocModel' does not satisfy the constraint 'IModel'.

Reproduce

  1. cd document
  2. pip install -e .

Context