React-diagrams: PortWidget port null error

Created on 12 Oct 2019  路  3Comments  路  Source: projectstorm/react-diagrams

Any ideas how to resolve this issue? It's from the TSCustomNodelWidget demo.

Type 'PortModel<PortModelGenerics> | null' is not assignable to type 'PortModel<PortModelGenerics>'.

Type 'null' is not assignable to type 'PortModel<PortModelGenerics>'. TS2322

For

<PortWidget port={this.props.nodeModel.getPort('in')} ... />

Most helpful comment

I think the solution should not to downgrade the level of typescript but adding a null to the PortProps.port interface

All 3 comments

Hey @quangas I got stuck in the same issue. Mind sharing how you resolved this?

Thanks!

I fixed it by changing strict to 'false' in tsconfig.json. I'm using Create-React-App with Typescript.

I think the solution should not to downgrade the level of typescript but adding a null to the PortProps.port interface

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jardg picture jardg  路  3Comments

msaglietto picture msaglietto  路  3Comments

abhijitnandy2011 picture abhijitnandy2011  路  3Comments

gugaevkirill picture gugaevkirill  路  3Comments

t-gacema picture t-gacema  路  4Comments