Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve the TS Config file path from a project instance? #1582

Open
bennycode opened this issue Oct 24, 2024 · 1 comment
Open

How to retrieve the TS Config file path from a project instance? #1582

bennycode opened this issue Oct 24, 2024 · 1 comment

Comments

@bennycode
Copy link

I can setup a new project like this:

const project = new Project({
  tsConfigFilePath: "path/to/tsconfig.json",
});

How can I retrieve this path from the project instance? I tried using project.getRootDirectories()[0]?.getPath(), but it adds a src directory to the path if specified in the include option.

@bennycode
Copy link
Author

I am now grabbing it from a SourceFile by accessing some internal state:

console.log(sourceFile.getProject().compilerOptions['_settings'].configFilePath);

Is there a better way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant