type inference for js