Solvedangular TypeScript 2.7 support

TypeScript 2.7 is coming out in January. We need to get it supported within the v6 timeframe.

  • #22097 ensure that we can compile our codebase with 2.7
  • make the compiler compatible with 2.7
  • retain support for TypeScript 2.6 to make g3 upgrade easier
35 Answers

✔️Accepted Answer

@cyrilletuzi Nothing forces @Input() to be set. A user of the your component may simply chose not to bind to that input in which case your @Input() is not initialize and you should have checks for non-initialized case. I know we disagree, but I think this is the correct behavior.

What would be nice is to have @Input({required:true}) which would be an error if the user created your component and did not bind to that @Input, but as of yet we don't have such a feature.

Other Answers:

Could @Input({required:true}) not be accomplished just using ts somehow? By analyzing the @Input variable type and seeing if undefined is an acceptable type?

More Issues: