TypeScript set string = null fails, but null! works

前端 未结 0 512
清酒与你
清酒与你 2021-01-05 02:11

In my TypeScript class, why does this fail:

export class MyClass {
    x:string = null //throws IDE warning (type \'null\' is not assignable to \'String\')
}
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题