Simplify typescript plugin code