[JS] Fix automatic guessing