type.as -> type.cast + es6 refactor (polyfill isolation)