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

Can't use Promise in template expression #1441

Closed
Rich-Harris opened this issue May 10, 2018 · 2 comments · Fixed by #1444
Closed

Can't use Promise in template expression #1441

Rich-Harris opened this issue May 10, 2018 · 2 comments · Fixed by #1444
Labels

Comments

@Rich-Harris
Copy link
Member

Side-issue to #1440 — you can't use Promise in a template expression without declaring it as a helper (or as data). It should be among the whitelisted globals:

{#await Promise.resolve(42)}
  <p>waiting...</p>
{:then answer}
  <p>the answer is {answer}</p>
{/await}

{#if true}
  <p>true!</p>
{/if}

<!-- the script block should be unnecessary -->
<script>
  export default {
    helpers: { Promise }
  };
</script>
@acstll
Copy link
Contributor

acstll commented May 10, 2018

I could try a "good first issue" kind of PR, it should be adding 'Promise' about there:

no?

@Rich-Harris
Copy link
Member Author

exactly — that'd be awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants