Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set prop's initialised property based on declarator #2624

Closed
wants to merge 1 commit into from
Closed

Set prop's initialised property based on declarator #2624

wants to merge 1 commit into from

Conversation

pshrmn
Copy link

@pshrmn pshrmn commented Apr 30, 2019

Currently, a variable's initialised value is set based on the init property of a VariableDeclaration. However, the init property exists on VariableDeclarators, not VariableDeclarations, so initialised is always false.

<script>
  export let myVar = 3;
  // internally, myVar.initialised = false
</script>

This PR sets initialised based on the init value of a VariableDeclarator.

This change allows a prop to be explicitly initialized to undefined without receiving a warning.

<script>
  export let thing = undefined; // will not warn if not provided
  export let other; // will warn if not provided
</script>

@pshrmn pshrmn changed the title Set initialised property based on declarator Set prop's initialised property based on declarator May 1, 2019
@Rich-Harris
Copy link
Member

Thank you! I saw #2637 (which is basically identical fix) and merged it before I saw this, so I'll close this PR

@Rich-Harris Rich-Harris closed this May 4, 2019
@pshrmn pshrmn deleted the initialised branch May 4, 2019 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants