template-lint
template-lint copied to clipboard
Support type assignment checking
- [ ] For known types, check that the access-chain target is assignable to the binding target.
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
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.
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.
Have You asked help from TypeScript team/project? The need for the workaround seems very odd.
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.