Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda