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

211
Views
How to find path to class/interface in TS/JS/Node.js

I need to find path to the file from which the class/interface is exported. Let's say i have a file builder.ts inside ./src folder with following content:

export class Builder {}

And i have index.ts in current directory, with following content:

import { Builder } from "./src/builder";

Later, i might need to know the path to the file, from which Builder class was imported, so i want to have some kind of function, that would take a class/interface/ and return the path to the file where the entity is defined. So i could write something like this in the index.ts file

const path = getPath(Builder)

And path variable should equal to "./src/builder". Is it possible to have this kind of function?

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!