Is it possible to refactor TypeScript field initialisation into a method while maintaining strictness?

后端 未结 0 1322
你的背包
你的背包 2021-01-17 07:21

Say I have a TypeScript class:

class Foo {
   bar: number;
   constructor() {
       this.bar = 42;
   }
}

If I refactor it so that it looks

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