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

riot cli in webstorm not compiling typescript with let or const #26

Closed
TimWillis opened this issue Apr 17, 2017 · 8 comments
Closed

riot cli in webstorm not compiling typescript with let or const #26

TimWillis opened this issue Apr 17, 2017 · 8 comments
Labels

Comments

@TimWillis
Copy link

I am using riot cli in webstorm(don't think that matters), and I have a riot tag like this ->
<students_info> <div class="page_container" style=""> test </div> <script type="typescript"> let x = 1; </script> </students_info>
riot doesn't show any compile errors, but returns a js file with the word 'undefined' in it. if I change it to var it works. Other things like arrow functions and other things for typescript work fine as long as no let or const.

@GianlucaGuarini
Copy link
Member

have you properly configured typescript http://riotjs.com/guide/compiler/#typescript?

@TimWillis
Copy link
Author

TimWillis commented Apr 17, 2017 via email

@GianlucaGuarini
Copy link
Member

have you tried compiling via terminal? Could you please post your code?

@TimWillis
Copy link
Author

TimWillis commented Apr 17, 2017 via email

@GianlucaGuarini
Copy link
Member

If the compiler does not fail and the error is in your runtime script this is not a bug. The compiler scope is to output vaild javascript without compromising your program logic. In your case the issue was in your code. Good luck

@TimWillis
Copy link
Author

OK, I found the issue, I thought I had a bug in my code, but it was something different. The following compiles fine in a ts file:
let workbook: any = XLSX.read({}, {type: 'binary'});
But when I put it in a tag file like the following, and either using the webstorm file watcher or the cli it returns the word undefined in the generated js file. Why would it compile in a ts file, but not in the tag file?

<student_settings> <div class="page_container" style=""> </div> <script type="typescript"> let workbook: any = XLSX.read({}, {type: 'binary'}); </script> </student_settings>

@GianlucaGuarini
Copy link
Member

it should be fixed in riot-cli@3.0.1 thanks for reporting the issue

@TimWillis
Copy link
Author

Awesome, thank you!

GianlucaGuarini added a commit that referenced this issue Apr 20, 2019
* dev: (21 commits)
  added: release notes
  fixes #34
  5.1.0
  updated: unit test and changelog
  Update CHANGELOG.md
  updated: refactor the code in order to export the API.cli function
  updated: remove the isSilent flag for the API export branch
  updated: dependencies and fixed #26
  Wraps by try block and reject on error
  Partially restores to previous code
  Makes it silent always when opt.stdout is true
  Returns promises
  Avoids negative conditions
  Adds tests
  Handles stdin and stdout
  Adds new options: stdin, stdout
  Uncomment the line accidentally commented out in previous commit
  Updates tests
  Adds `prepare` task to npm scripts
  Fixes small lint error
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants