Skip to content

Change missing property errors to warnings? #475

@ccampbell

Description

@ccampbell

After upgrading to the latest version of Svelte I was met with a bunch of Component was created without expected data property 'whatever' errors that broke my application.

It is not a huge amount of work to set default values for the properties using the data() method, but I personally liked that previously you could do things like this where your component can be hidden by default until you explicitly set({ show : true }) on it:

<div class="something{{ show ? ' show' : '' }}">Hello</div>

I find it convenient to not have to pass show="false" when initializing the component. I think for an outsider coming to svelte for the first time they would expect it to work the same way as I did (any property you reference is treated as undefined until you set a value to it) just cause that is how variable values and object properties work in javascript in general.

Anyway I think it would make sense to change this to a warning instead of breaking your whole application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions