Destructured parameter properties in constructor

后端 未结 3 1097
情歌与酒
情歌与酒 2020-12-20 12:37

Typescript allows parameter properties

class ParameterProperty {
  constructor(private member: number) {}
}

The above creates a class with

3条回答
  •  温柔的废话
    2020-12-20 13:23

    In ECMAScript, destructuring assignment results in variables in variables (not properties than properties) receiving the component values.

    There has been a TypeScript feature request/suggestion for combining destructuring with parameter properties open since October of 2015. That would probably be the most effective place to track the status of whatyou want.

提交回复
热议问题