add var keyword and pass type through typeForRoot