I feel like I’m stealing from the comments already given, but I think this deserves to be an actual answer:
The “Unexpected identifier” is type
which is not a valid javascript token.
Your “js file” appears to be instead a TypeScript file, which the browser does not understand. To run it in the browser you must compile it to JavaScript first.
1
solved Uncaught SyntaxError: Unexpected identifier in html