Angular 6 library – Typescript compilation not working

This topic contains 7 replies, has 2 voices, and was last updated by 1 year, 3 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #597330 Reply

    sayantansinha
    Participant

    Hi,
    I have a angular app built using Angular Cli 6.x and the app only has a library project within it. Unfortunately, the typescript compilation does not work, although I have a main tslint.json and a library specific tslint.json which extends the main tslint json.
    Any help would be greatly appreciated.

    #597345 Reply

    support-tony
    Keymaster

    sayantansinha,

    Could you give us more details?

    How did you create your eclipse project? I’m not sure how tslint is involved here; could you give more details on what you mean by “compilation does not work” (that is, what actions are you taking, any errors seen, and so on)?

    For reference, I tried creating an Angular workspace outside of eclipse, with just a library project inside (which involved creating a normal app with ng new, then generating a library project and removing the other projects that were created with ng new, then importing as an Angular project in eclipse. I see no problems when I run an ng build for the library, with the dist folder files being created.

    #597350 Reply

    sayantansinha
    Participant

    Tony,
    Thanks for responding. The issue is not particular to “ng build”, that is working fine and compilation is working fine for that when I trigger it through Terminal+ or my Mac’s Terminal window.

    I was referring to the compilation errors that Angular IDE is suppose to show on the eclipse typescript editor in case of a scenario like syntax errors, missing imports, missing variable declaration that you generally expect out of an IDE (difference of coding on plain text editors).

    The reason I mentioned tslint is because I believe tslint lists out all the rules that should be followed for validating a typescript file which I believe the plugin should be using.

    Interestingly, I have another project setup (which is not a library) on the same workspace and for that I do see compilation errors/warnings on the editor itself, but not for the library projects that I have also in the same workspace.

    • This reply was modified 1 year, 3 months ago by  sayantansinha.
    • This reply was modified 1 year, 3 months ago by  sayantansinha.
    #597355 Reply

    support-tony
    Keymaster

    Sayantan,

    Right, you’re referring to the validation and tslint is most certainly involved in that.

    I don’t see a problem at my end but may not have the same project structure. If possible, can you create a sample eclipse project that exhibits this problem and attach a zipped version (without the node_modules folder) here? How did you create the eclipse project (presumably outside eclipse and then imported but how was that external project created)? Failing that, just a view of the full project structure (no need to show the node_modules structure) might help.

    Lastly, can you confirm you’re using the TypeScript editor that comes with Angular IDE? If you’ve installed our CodeMix plugin, the CodeMix TypeScript editor might be opening by default (though this should also work).

    #597369 Reply

    sayantansinha
    Participant

    I don’t see a problem at my end but may not have the same project structure. If possible, can you create a sample eclipse project that exhibits this problem and attach a zipped version (without the node_modules folder) here? How did you create the eclipse project (presumably outside eclipse and then imported but how was that external project created)? Failing that, just a view of the full project structure (no need to show the node_modules structure) might help.

    I have created a sample for you, which is attached (node_modules excluded). I created this project using Angular IDE itself, but created the library project using ng command from “Terminal+” as the IDE does not have that capability yet (something you are planning to add in future?). Some of my projects are existing project which was created using the Angular CLI (Angular IDE I am guessing uses the same), so I do not think there would be much difference. But, nonetheless, both are exhibiting the same problem. If you open the “angular-lib.component.ts”, you will see there are few errors, attached screenshot with highlights, to indicate where there should be an error shown, but nothing is shown.

    Lastly, can you confirm you’re using the TypeScript editor that comes with Angular IDE? If you’ve installed our CodeMix plugin, the CodeMix TypeScript editor might be opening by default (though this should also work).

    I only see one typescript editor option when I try to open a typescript file. Attached screenshot as well. Not sure what others are available.

    Attachments:
    You must be logged in to view attached files.
    #597401 Reply

    support-tony
    Keymaster

    Sayantan,

    Thanks for the sample. I do now see the problem and have raised a bug for development to investigate. However, you should know that our CodeMix technology will be incorporated into future releases of Webclipse (and its associated plugins like Angular IDE). With the CodeMix editor, I do see validation errors.

    You can install CodeMix now, using the eclipse MarketPlace, if you don’t want to wait for its incorporation into a future release of Webclipse (though this is likely to happen within a few weeks). Your Webclipse license is enough to use Codemix; you don’t need a separate license.

    Regarding support of library project generation, yes, we will be looking to support this better.

    Thanks for reporting this. Let us know if you have further problems.

    #597402 Reply

    sayantansinha
    Participant

    I installed it, and now I can see validations kicking in, thanks!
    Just curious, there are 2 types of typescript editor, one says “TypeScript: CodeMix” and the other “TypeScript React: Codemix”. The latter one seems more useful as that shows the validation errors but not the former one I mentioned.
    What is the difference?

    One more feedback, the error does not show up on hover, (as it does for the Java Editor in eclipse), I had to physically click on the icon that appeared besides the line numbers to see the error and then resolve it. Not sure if that is ideal but works for now.

    #597405 Reply

    support-tony
    Keymaster

    Sayantan,

    Basic support for REACT projects is included with CodeMix (though better support is provided by installing the CodeMIx React pack) so the TypeScript React :: CodeMix is for React TypeScript files (usually with .tsx file extension). Both editors should show syntax errors but maybe the CodeMix engine was still connecting when you opened the first editor.

    I think we have the problem, with hover not showing the error, under investigation but will need to check. Also note that hovering over the error mark in the ruler area will show the error.

    Thanks for the feedback.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Angular 6 library – Typescript compilation not working

You must be logged in to post in the forum log in