-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Integration with AngularJS - Compile AngularJS bindings in HTML files #369
Comments
Will be closed as not a part of the Design goals. But I'd like to hear any community work. |
What basarat said. We're not an HTML compiler, but it would be cool to see someone write an HTML validator that used TypeScript files as a reference. |
It will be a killer feature to implement! type check will be finally complete! actually parsing only .ts and no html leave code not really safe.. |
There is JSX support baked into TypeScript ... and I recommend looking into that 🌹 Quick rundown |
i'm trying to implement type check in html angular bindings, |
I imagine something like |
also see #5151 for related discussion. |
@Gambero81 would be interested to see how this work proceeds; would appreciate it if you can share your progress. |
I wrote a project to handle this issue specifically for angular1 views. It uses the typescript compiler API to parse the javascript and typescript code, htmlparser2 to parse the views, and the parsimmon parser combinator library to parse angular expressions (such as "for .. in .. track by .."). It then generates "viewtest" files, combining code from views and controllers, which then get type checked by the compiler at the same time as normal typescript files. It also allows the user to specify custom angular directives & filters to have them also type-checked. Obviously it does not support everything possible with angular1, by far, as the scope is huge, but we use it on a real-size project at work, and tested it on another real-size one too. You can find the project there: |
Consider the following code in an HTML file:
Since we know that "home" is an instance of HomeController, it would be great if TypeScript could compile that and throw a compilation error if "property1" doesn't exist in its definition.
The text was updated successfully, but these errors were encountered: