1、设置泛型将参数配置为 null 时抛出了如下异常:
Type 'null' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'null'. <ArkTSCheck>
解决办法
在 null 后面添加 ! 即可,以表示该值不会为 null
data: T = null!
1、设置泛型将参数配置为 null 时抛出了如下异常:
Type 'null' is not assignable to type 'T'. 'T' could be instantiated with an arbitrary type which could be unrelated to 'null'. <ArkTSCheck>
解决办法
在 null 后面添加 ! 即可,以表示该值不会为 null
data: T = null!