'Observable' is not a class derived from 'Observable'

前端 未结 9 2415
灰色年华
灰色年华 2020-12-29 18:11

When trying to extend a class from a class in a node_modules the typescript compiler throws a error saying:

Property \'source\' is protected but

9条回答
  •  一向
    一向 (楼主)
    2020-12-29 19:03

    I was getting a crazy error like

    Type 'Observable' cannot be converted to type 'Observable'
    Property 'source' is protected but type 'Observable' is not a class derived from 'Observable'
    

    And the reason was npm link (actually npm i ../other-project but it's quite the same thing).

    My workaround was kinda cheating:

    (stream as any as Observable)
    

    LOL

提交回复
热议问题