react-component/tree

Compilation errors with TypeScript 4.8.x

jljouannic opened this issue ยท 12 comments

After upgrading typescript to version 4.8.2, I get the following compilation errors running tsc on my project:

node_modules/.pnpm/rc-tree@5.6.7_biqbaboplfbrettd7655fr4n2y/node_modules/rc-tree/lib/NodeList.d.ts:15:23 - error TS2344: Type 'TreeDataType' does not satisfy the constraint 'BasicDataNode'.

15     data: FlattenNode<TreeDataType>[];
                         ~~~~~~~~~~~~

  node_modules/.pnpm/rc-tree@5.6.7_biqbaboplfbrettd7655fr4n2y/node_modules/rc-tree/lib/NodeList.d.ts:12:25
    12 interface NodeListProps<TreeDataType> {
                               ~~~~~~~~~~~~
    This type parameter might need an `extends BasicDataNode` constraint.

node_modules/.pnpm/rc-tree@5.6.7_biqbaboplfbrettd7655fr4n2y/node_modules/rc-tree/lib/NodeList.d.ts:18:29 - error TS2344: Type 'TreeDataType' does not satisfy the constraint 'BasicDataNode'.

18     activeItem: FlattenNode<TreeDataType>;
                               ~~~~~~~~~~~~

  node_modules/.pnpm/rc-tree@5.6.7_biqbaboplfbrettd7655fr4n2y/node_modules/rc-tree/lib/NodeList.d.ts:12:25
    12 interface NodeListProps<TreeDataType> {
                               ~~~~~~~~~~~~
    This type parameter might need an `extends BasicDataNode` constraint.


Found 2 errors in 1 file.

Errors  Files
     1  node_modules/.pnpm/rc-tree@5.6.7_biqbaboplfbrettd7655fr4n2y/node_modules/rc-tree/lib/NodeList.d.ts:15

Environment:

  • react 18.2.0,
  • antd 4.23.0,
  • typescript 4.8.2.

Same for me. For know I just downgrade typescript to 4.7.4.

I think that the solution is pretty simple, just make TreeDataType extends BasicDataNode.

The same problem, how did you solve it?

@MadCcc heads up - this problem is now resolved if you want to make a new release ๐Ÿ‘

can this be released or is something blocking?

@MadCcc @afc163 @zombieJ please make release

@MadCcc @afc163 @zombieJ please make release

+1

Why is this still not fixed? We can't upgrade TypeScript or Ant until this is fixed, and it's been almost two months. Please make a new release!

@afc163 ping

@MadCcc ping

Any update?
@afc163 @MadCcc

Fixed in #636

Version 5.7.1 has been released and fixes the type checking issues.