2

I have an Angular 2 application in which i wish to use gulp to concat som libary files.

My task for just that look as follows: enter image description here

This produces a JS file and i reference it in my index.html: enter image description here

Now when i run this i get the following: enter image description here

and as we all know, there a no such thing as interfaces in js i must be dealing with typescript.

Can someone please tell me how to convert the typescript files in my libraries to js?

1
  • maybe you should concat only the .js files from the @angular and rxjs folders. Otherwise you might end up adding some d.ts files too in there. Commented Jul 26, 2016 at 11:14

2 Answers 2

1

The rxjs/** and @angular/** lines in the gulp.src task will result in all the files in those folders being concatenated. That means the .ts and .d.ts files in those folders as well.

You should change those lines to include only the javascript files.

For example:

rxjs/**/*.js
@angular/**/*.js

That should result in only javascript files being included.

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for the quick response ! That helped on the interfaces! Now i am however hit by another error : "Uncaught SyntaxError: Unexpected token export", again in my all.js Does any of you have an idea why this can be?
I fear that might have a different answer though, would you be so kind as to ask as separate question about that? :)
@methgaard if the answer fixes your issue please mark it as such. :)
0

Sounds like you're concatenating your ts source files into all.js, instead of the compiled js output from that ts.

It's not clear from the given example what you are using to do this, but you may need to add gulp-typescript to your gulp pipeline.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.