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

236
Views
TypeScript: Importing a module in a Typescript project?

I have some static data I am trying create a lookup table for so I have an object in a TS file:

newTSFile.ts

export declare module FontList { 
   export DEFAULT_DATA: {
       'james': {
           'age': '23'
        },
        'jack': {
           'age': '22'
        }
   }
}

then in my main TS file, I am importing as

import { FontList } from './newTSFile';

// 
console.log("font list: ", FontList)

however, it still can't find the file when compiling with the error: Error [ERR_MODULE_NOT_FOUND]: Cannot find module .../FontList . Not sure what I am doing wrong here in regards to importing

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Try this:-

newTSFile.ts export const FontList: { 'james': { 'age': '23' }, 'jack': { 'age': '22' } }

main TS file import { FontList } from './newTSFile';

about 4 years ago · Santiago Gelvez 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!