Skip to content

Feature request: exclude outDir by default in tsconfig.json #20108

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

Open
jsamr opened this issue Nov 17, 2017 · 8 comments
Open

Feature request: exclude outDir by default in tsconfig.json #20108

jsamr opened this issue Nov 17, 2017 · 8 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

@jsamr
Copy link

jsamr commented Nov 17, 2017

Scenario: As a user, I want typescript compiler to default-exclude output transpiled files to compilerOptions.outDir with compilerOptions.declaration property set to true. I would expect that outDir is excluded by default, because:

@jsamr jsamr changed the title Exclude outDir by default in tsconfig.json Feature request: exclude outDir by default in tsconfig.json Nov 17, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Nov 17, 2017

Not sure i understand the request, outDir is excluded by default from a compilation, e.g.:

c:\test\20108>tree /F
│   a.ts
│   tsconfig.json
│
└───outDir
        b.ts


c:\test\20108>type tsconfig.json
{
    "compilerOptions": {
        "target": "es5",
        "outDir": "./outDir"
    }
}

c:\test\20108>tsc --v
Version 2.7.0-dev.20171109

c:\test\20108>tsc --listFiles
C:/Users/mhegazy/AppData/Roaming/npm/node_modules/typescript/lib/lib.d.ts
c:/test/20108/a.ts

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Nov 17, 2017
@jsamr
Copy link
Author

jsamr commented Nov 18, 2017

I have a configuration where it doesn't. I'll work on a MWE and come back to you !

@jsamr
Copy link
Author

jsamr commented Nov 18, 2017

@mhegazy I think I have found the reason : default excluded values are overwritten instead of merged when setting your own custom values.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 18, 2017

If you define your own excludes we get out of the exclude business altogether. I recommmend using include instead.

@jsamr
Copy link
Author

jsamr commented Nov 19, 2017

@mhegazy OK thanks for that clarification. However, exclude is difficult to avoid when implementing tests we don't want typescript to compile. I believe this scenario is so common that many users don't concretely benefit from default excludes...

@mhegazy
Copy link
Contributor

mhegazy commented Nov 20, 2017

I believe this scenario is so common that many users don't concretely benefit from default excludes...

I have not seen requests for this before to be frank. leaving this issue open to gather more user feedback.

@mhegazy mhegazy added 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 and removed Needs More Info The issue still hasn't been fully clarified labels Nov 20, 2017
@liron-navon
Copy link

@mhegazy
The "outDir" is not excluded by default, when I tried to enable js files in my project, typescript tried to compile the "dist" (which is registered as the outDir), the issue was resolved by adding:

 "exclude": [
   "node_modules",
   "dist"
 ]

But it really surprised me, since I expected the outdir to be excluded by default.

@leotm
Copy link

leotm commented Mar 27, 2020

My scenario was I checked out react-native-template-typescript, ran yarn tsc, was greeted with error TS5053: Option 'noEmit' cannot be specified with option 'incremental', read the 3.4 release notes, decided to try incremental from the get-go. Cannot write file 'MyApp/index.js' made sense, so went with isolating the emitted files to "outDir": "./lib", only surprised to experience #8249 per compile because I expected it to be excluded by default, as I haven't gotten to structuring my project to the point of e.g. "include": [ "src" ]" just yet. Finding myself thinking alike #8249 (comment).

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