Skip to content

Property initialisation check in TS 3.5 is too strict for ember 3.5 #31682

Open
@sandersn

Description

@sandersn

Start reading here: #29395 (comment)

import Component from '@ember/component';
import defaultTo from 'lodash/default-to';

export default class Welcome extends Component {
  greeting: string = defaultTo(this.greeting, "Hello");
}

Briefly, ember 3.5's Components have properties that are initialised by the base to a value, but Typescript doesn't know about this. Users should be able to squash the error by writing greeting!: string = ..., or by turning off strictPropertyInitialization, but can't today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions