aurelia / template-lint

Sanity check of Aurelia-flavor template HTML
Apache License 2.0
56 stars 17 forks source link

Support type assignment checking #136

Open MeirionHughes opened 7 years ago

MeirionHughes commented 7 years ago

Don't know how to do type assignment checking with the typescript library. I don't really want to create a program object ( to get a type-checker object) unless absolutely necessary. Creating a ts.Program is not so bad as you can make your own host (de facto file system) and do everything in memory

MeirionHughes commented 7 years ago

This might help. http://blog.scottlogic.com/2015/01/20/typescript-compiler-api.html Looks like you can implement your own host then make a language service; that then might allow getting the Program and then onto the typechecker.

MeirionHughes commented 7 years ago

I don't think TypeChecker will help. The "isTypeAssignableTo" stuff is all hidden away (checker.ts). Without making changes to typescript lib, I think workaround is to generate some source code that does the assignments and try to compile it to see if it complains.

atsu85 commented 7 years ago

Have You asked help from TypeScript team/project? The need for the workaround seems very odd.

MeirionHughes commented 7 years ago

Not yet, got told off last time I asked a question on there. So far the question on SO on this doesn't have a (good) answer.

Update: I've asked on on the typescript project now https://github.com/Microsoft/TypeScript/issues/11728

Update: looking good to be added to typescript.