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

Make it possible to pass rootDirs and paths via cli #49434

Open
5 tasks done
Psy-Kai opened this issue Jun 8, 2022 · 3 comments
Open
5 tasks done

Make it possible to pass rootDirs and paths via cli #49434

Psy-Kai opened this issue Jun 8, 2022 · 3 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@Psy-Kai
Copy link

Psy-Kai commented Jun 8, 2022

Suggestion

πŸ” Search Terms

  • tsc cli "rootDirs"

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

It should be possible to pass --rootDirs and --paths via CLI. This would make it easier to integrate with (non-js)-buildtools, which just call the CLI.

πŸ“ƒ Motivating Example

Make it easier to use the tsc-cli with arbitrary build-tools in big projects without using a tsconfig.json.

πŸ’» Use Cases

My specific use-case is a project with generated files (protobuf). I want to generate the files into a build/dist directory but need a way for referencing the file properly (which I would do with rootDirs or the baseUrl, paths pair). I also want to use a buildtool which just calls the tsc-cli for every file (like when compiling C-sourcecode).

@Psy-Kai
Copy link
Author

Psy-Kai commented Jun 8, 2022

Another approach would be #27379 and just use the compilerOptions.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Jun 9, 2022
@kkmuffme
Copy link

+1

The workaround doesn't work when you want to run tsc for a single file only without having to create a separate (extending) tsconfig all the time.

@HolgerJeromin
Copy link
Contributor

HolgerJeromin commented Jun 11, 2024

To give some context:
The doc pretends that this is possible. But using that results in

error TS6064: Option 'paths' can only be specified in 'tsconfig.json' file or set to 'null' on command line.

The syntax is working with typeRoots though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants