I have a .ts file with:
JavaScript
export module test.employee {
export interface person {
name: string;
age: number;
}
}Now I want to import and use person interface/class in normal JS file.
So how we can do that?
I have a .ts file with:
export module test.employee {
export interface person {
name: string;
age: number;
}
}Now I want to import and use person interface/class in normal JS file.
So how we can do that?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Jan 23, 2023, 3:17 AM EST
you can import compiled ts in your js using
const { ClassName } = require('./ClassName'); var obj= new ClassName();