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

357
Views
How to import a TypeScript function in JavaScript?

I am struggling while trying to import my TypeScript function into JavaScript, I am getting the following error:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "video/mp2t". Strict MIME type checking is enforced for module scripts per HTML spec.

This is my TypeScript code:

export function getStatus(): any {

    fetch('https://authserver.mojang.com/', {
       method: 'GET'
    }).then((response) => {
        console.log(response.status);
        return response.json();
    });

    return null;
}

And this is my JavaScript code:

import { getStatus } from "../ts/Status.ts";

let root = document.documentElement;

function setOnline() {
    root.style.setProperty('--status-color', '#47ff75')
}

function setWarning() {
    root.style.setProperty('--status-color', '#ffb247')
}

function setOffline() {
    root.style.setProperty('--status-color', '#eb3838')
}

document.onload(() => {
    console.log(getStatus());
});

Thank you a lot for helping! Greetings, Leander :)

about 4 years ago · Juan Pablo Isaza
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!