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

134
Views
Cannot find name 'FontFace'. TS2304

I am trying to load fonts dynamically for my project. I dont understand why I'm getting this error.

"Cannot find name 'FontFace'. TS2304"

Following is the code for your reference:

 const loadFont = (name: string, source: string) => {
    const font = new FontFace(name, `url(${source})`);
    font
      .load()
      .then(function (loadedFont: any) {
        document.fonts.add(loadedFont);
        document.body.style.fontFamily = name;
      })
      .catch(function (error) {
        console.log(error);
      });
  };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you are using Typescript, make sure you have installed type definitions for CSS Font loading modules

npm install --save @types/css-font-loading-module

Ref: https://www.npmjs.com/package/@types/css-font-loading-module

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