prismake / typegql

Create GraphQL schema with TypeScript classes.
https://prismake.github.io/typegql/
MIT License
424 stars 21 forks source link

getters are invoked with a wrong context and also they are invoked on startup when inferring native types #32

Closed capaj closed 6 years ago

capaj commented 6 years ago

function inferTypeByTarget just accesses a variable in order to infer a type. This is not compatible with getters, because it is invoking them just by accesing it.

Also when getters are invoked at runtime they are invoked on the prototype rather than from source. This causes problems when getters try to access some instance field. Fix incoming.

capaj commented 6 years ago

@pie6k same as with the other one- I can open a PR as soon as you merge prettier branch.

pie6k commented 6 years ago

Great! I've merged PR with prettier now :)

pie6k commented 6 years ago

It's fixed. I've added proper test cases. Also thanks for your PR @capaj !