Our Ember components often use the following pattern which is working as expected with ember-typescript 2:
export default class DatePicker extends Component {
format: string = this.format || 'dd/LL/yyyy';
}
If format is not passed via the template it is initialized with 'dd/LL/yyyy'.
With ember-typescript 3 and the newer TS version the compiler is not happy anymore. It complains with
error TS2729: Property 'format' is used before its initialization.
as it is not happy with the usage of this.format
.
What should I do to solve this problem? Is our code (which works fine so far) invalid and should be changed? If yes how?
Aucun commentaire:
Enregistrer un commentaire