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

Silently compile even with errors #33

Open
yjukaku opened this issue Oct 16, 2015 · 3 comments
Open

Silently compile even with errors #33

yjukaku opened this issue Oct 16, 2015 · 3 comments

Comments

@yjukaku
Copy link

yjukaku commented Oct 16, 2015

We are currently using the .ts extension for some of our files that are plain javascript. The tsc command will output a .js file regardless of if there are Typescript errors in the .ts file. Is there any way to enable this behavior for this gem?

@yjukaku yjukaku changed the title Silently compile without errors Silently compile even with errors Oct 16, 2015
@bdrazhzhov
Copy link
Member

Hello @yjukaku,
Not clear what you want. Could you provide an example of file with error, tsc command with appropriate params and what you expect to see after command executing?

@yjukaku
Copy link
Author

yjukaku commented Oct 19, 2015

Save this file with the ts extension in the Rails javascripts folder.

// app/assets/javascripts/plain.js
$(function(){
  console.log("I'm a plain javascript file, using jquery, but saved with a .ts extension");
});

Error:

Typescript error in file 'test/app/assets/javascripts/plain.ts':
/var/folders/36/clbwldqs6039l61kp6q1jxkh0000gn/T/typescript-node20151019-785-1pc7706.ts(1,1): error TS2304: Cannot find name '$'.

Obviously the issue is that we aren't declaring/importing the $. But if I ran this using tsc plain.ts, it would show the same error BUT still output the javascript file plain.js. Basically, I want the option for the typescript-rails gem to still render the page but just log the error messages. I understand why this isn't the default behavior but I think an option is necessary for some cases.

@bdrazhzhov
Copy link
Member

Sorry. It is not possible. If you want to use plain js use it in .js-files and don't try to compile via tsc.
Or you can fork it and create your own implementation.

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

No branches or pull requests

2 participants