compiler: js: write required fields correctly