Skip to content

Conversation

@eteeselink
Copy link

This is really a feature suggestion with a bit of code attached.

I would like tsc to accept an outExt parameter, so that I can differentiate generated-from-TS .js files from raw javascript files. This has all kinds of benefits, including easily .gitignore-ing files in a directory that contains both TypeScript sources and raw JavaScript (or, in my case, React components).

For example, calling tsc --outExt .ts.js types.ts will generate types.ts.js instead of types.js. Then, i can add *.ts.js to my gitignore and do require("types.ts") (which Node/Browserify will resolve to "types.ts.js") in my raw JavaScript code.

Does a PR like this have a chance to be accepted at all? If so, I'll go ahead and sign the Contribution License Agreement, but I prefer to avoid paperwork if this simply gets a "denied, we only accept bug fixes, sorry"-kind of response.

http://stackoverflow.com/questions/23408952/is-it-possible-to-have-typescript-output-in-different-file-extension shows that I'm not the only one looking for this.

I'll be happy to add tests and diagnostic messages and all that, so that it's entirely neat and tidy.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 11, 2014

Thanks for submitting this change. One of our principals is to keep the compiler options as simple as possible and as general as possible. This avoids confusion, and unforeseen interactions between different option combinations.

One of our goals in TypeScript 1.2 is to have a compiler API that allows customizing the compiler, this would be a way to ease customizations.

@mhegazy mhegazy closed this Aug 11, 2014
@eteeselink
Copy link
Author

OK! Too bad, but I understand. Thanks for the clear explanation.

(btw, maybe it would be useful to add 1.2 to the roadmap? a lot of people are currently making all kinds of workarounds and hacks to deal with the lack of a compiler API, so it's very good to know that official support is coming)

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants