jasnell / proposal-istypes

TC-39 Proposal for additional is{Type} APIs
201 stars 7 forks source link

Suggest rename typeof to typeOf #31

Closed azz closed 7 years ago

azz commented 7 years ago

Currently the following is both invalid syntax and extremely confusing:

const { typeof } = Builtin; // SyntaxError
typeof ([]); // "Array"

Why not rename to typeOf such that the following is valid and not ambiguous?

const { typeOf } = Builtin;
typeOf([]); // "Array"
ljharb commented 7 years ago

Makes sense.

jasnell commented 7 years ago

I tend to prefer the symmetry of Builtin.typeof to typeof but concede the point. Renaming is good.