JS: Factorizing type analysis of literals.