Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

466
Views
Having a problem with a MIME error, I'm starting with typescript

I am translating a code from javascript to typescript and everytime i try to run it to see how it goes it shows these following errors.

indexjuego.html:20 Uncaught ReferenceError: mark is not defined at HTMLButtonElement.onclick (indexjuego.html:20:78)

Refused to execute script from 'http://127.0.0.1:5500/js.ts' because its MIME type ('video/mp2t') is not executable.

The code used to work perfectly before trying to use typescript so i know that the function mark is properly written.

I tried to look into mime type and what it is but it is still unclear

This is the part on the html code where I try to call the function mark

<div class="botones">   

        <button id="id1" style="margin: 17px;" onclick="mark(this.id)"  >  </button>
        <button id="id2" style="margin: 10px;" onclick="mark(this.id)"  >  </button>
        <button id="id3" style="margin: 10px;" onclick="mark(this.id)"  >  </button><br>
        <button id="id4" style="margin: 17px;" onclick="mark(this.id)"  >  </button>
        <button id="id5" style="margin: 10px;" onclick="mark(this.id)"  >  </button>
        <button id="id6" style="margin: 10px;" onclick="mark(this.id)"  >  </button><br> 
        <button id="id7" style="margin: 17px;" onclick="mark(this.id)"  >  </button>
        <button id="id8" style="margin: 10px;" onclick="mark(this.id)"  >  </button>
        <button id="id9" style="margin: 10px;" onclick="mark(this.id)"  >  </button>
        
    </div>

and this is the function mark

function mark(id) {
if (turn % 2 == 1) {
    console.log("asdas")
    document.getElementById(id).style.backgroundImage = "url('cruz.webp')";

} else if (turn % 2 == 0) {
    document.getElementById(id).style.backgroundImage = "url('circulo.webp')";

}

turno();
prueba();
cambiaturn();
winner(fin, finemp);
block(id);

}

The code is a tic tac toe game

about 4 years ago ยท Santiago Trujillo
1 answers
Answer question

0

Seems like you're using the live server extension to run the code, if so, *.ts files won't be executed, because you have to covert then to javascript first, the browser understands only javascript

About MIME type, it is a convention for file extensions, per example .pdf is application/pdf but I don't think that it has something to do with your problem

here is a nice tutorial on how compile typescript to javascript, hope it helps ๐Ÿ˜€

about 4 years ago ยท Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!