Skip to content

Problem with required TS. #13656

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

Closed
SergeySagan opened this issue Jan 24, 2017 · 12 comments
Closed

Problem with required TS. #13656

SergeySagan opened this issue Jan 24, 2017 · 12 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@SergeySagan
Copy link

SergeySagan commented Jan 24, 2017

With the new version of Typescript, not sure how recent, if you define a tsconfig but have no ts files to compile you get a

No inputs were found in config file

error.

Actually:

error TS18003: Build:No inputs were found in config file 'C:/Code/TSTest/tsconfig.json'. Specified 'include' paths were '["**/"]' and 'exclude' paths were '["../wwwroot/app","node_modules/"]'.
1> The command exited with code 1.
1> Done executing task "VsTsc" -- FAILED.

As I said, this is a fairly recent change and looking at the config options, I do not see a way to disable this requirement. My organization is building a large (30+ web and API projects) solution and instead of having each web have its own copy of the tsconfig, we prefer to have a single copy that gets injected into each of the web projects. However, not all of the projects have a need for custom JS so not all of them will have TS files... but now, all of our builds without a TS file fail! Why was this change made without allowing an option to disable this requirement? How do I work around this issue without having to reengineer our whole build process?!? These kinds of changes should not be made without considering how this will impact others!

@mhegazy
Copy link
Contributor

mhegazy commented Jan 24, 2017

The error was added to let users know that the compilation produced no outputs, since it had no inputs. some of the common mistakes is having a conflicting include and exclude patterns. see #11650 and #11621 for examples.

for your scenario, i would recommend using configuration inheritance instead, in each project that needs typescript, add a tsconfig.json, that extends from your main config file.

Alternatively, add a condition on your build task to not call the build unless
at least one .ts file is found in the directory, should save you an invocation to tsc.exe every time you build your project.

@mhegazy mhegazy added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jan 24, 2017
@SergeySagan
Copy link
Author

Why not just build in an option to not check for this issue?

@mhegazy
Copy link
Contributor

mhegazy commented Jan 24, 2017

We have a limited budget for new compiler options. adding new options increases complexity for both users and maintainers.

@SergeySagan
Copy link
Author

However this change is making it more difficult for your users! I am unsatisfied with this answer.

@basarat
Copy link
Contributor

basarat commented Jan 26, 2017

However, not all of the projects have a need for custom JS so not all of them will have TS files... but now, all of our builds without a TS file fail!

In short you want an option that will allow the TypeScript compiler to run without doing anything. Please reconsider why you are even running the compiler in these directories. This is a problem in your setup and not TypeScript.

This is just my personal opinion and can be wrong. This message was said to hopefully help you feel better. If that is not the case I am indeed sorry. Difference of opinion in a natural outcome of the human thought process 🌹 ❤️

@SergeySagan
Copy link
Author

SergeySagan commented Jan 26, 2017

For some reason when I create a new VS solution without having any C# files to compile, the compiler builds without throwing exceptions. This works with almost every other programming language out there. Team Typescript for some reason thinks they are better then everyone else and added a feature that is detrimental to its users. This is the kind of stupidy that kills successful projects. The programmer is a fickle one and loyalty runs only as long as your tool is best for the job... when you add stupid things like this that loyalty drops. At this point Typescript is best but I won't be pushing for it next time we make technology choices... the sad part is that this is an uber simple change that would have taken a dev less than 2 hours to implement. Instead you've created negativity around this project with the unyielding approach to user requests... very sad.

@basarat
Copy link
Contributor

basarat commented Jan 26, 2017

Team Typescript for some reason thinks they are better then everyone else and added a feature that is detrimental to its users.

Not really. FWIW there is precedence in the JavaScript community e.g. mocha gives a much more horrible experience:

image

Personally I am happy with what the TypeScript team has done. Of course that is just my opinion 🌹

@iamclaytonray
Copy link

I had a similar question but this issue answered it. I'm not the sappy type but I just wanted to say that I, as well as other developers that I know, love TypeScript. You guys do a great job. I don't know why some people feel entitled and demand things from open source maintainers. I'm really hoping the one(s) that got bent out of shape read this comment. TypeScript is open source. The TypeScript team is great and I look forward to using them on every JavaScript project I have, whether it's 100% perfect (NOT a reality for ANY software/language/framework/library/OSS) or it has it's flaws.

As a side note, wouldn't the error go away after a .ts or .tsx file is created? I deleted my .tsconfig.json, rewrote it, and it worked perfectly. Initially, I wrote my tsconfig.json without a .ts or .tsx file, added a file, and the issue still persisted. Similar to the OP but a little different.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 29, 2017

I wrote my tsconfig.json without a .ts or .tsx file, added a file, and the issue still persisted. Similar to the OP but a little different.

can you share a sample project?

@iamclaytonray
Copy link

Here's a basic boilerplate project that I just started. I've never worked with Webpack & TypeScript together. I'm sure it has something to do with that. Also, I've never worked with TypeScript and React together. And finally, my code sucks. It's incomplete. I'll add more to it later.

Here is the repo.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 29, 2017

not sure i see the issue.. this is what i am seeing:

c:\test\13656>git clone https://github.com/iamclaytonray/webpack-with-react.git

c:\test\13656>cd webpack-with-react

c:\test\13656\webpack-with-react>npm install

c:\test\13656\webpack-with-react>node_modules\.bin\tsc
src/app/AppIndex.tsx(5,39): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).
src/app/AppIndex.tsx(9,10): error TS2604: JSX element type 'Header' does not have any construct or call signatures.
src/app/AppIndex.tsx(10,17): error TS2339: Property 'props' does not exist on type 'AppIndex'.
src/app/AppIndex.tsx(11,10): error TS2604: JSX element type 'Footer' does not have any construct or call signatures.
src/app/Footer.tsx(2,10): error TS2305: Module ''react-router'' has no exported member 'Link'.
src/app/Footer.tsx(4,37): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).
src/app/Header.tsx(2,10): error TS2305: Module ''react-router'' has no exported member 'Link'.
src/app/Header.tsx(4,37): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).
src/app/NotFound.tsx(3,39): error TS2314: Generic type 'Component<P, S>' requires 2 type argument(s).
src/index.tsx(1,8): error TS1192: Module '"c:/test/13656/webpack-with-react/node_modules/@types/react/index"' has no default export.
....

@iamclaytonray
Copy link

Weird. I don't see the issue anymore. Initially, the first set of {} in thetsconfig.json was highlighted red and showed an error that said something like: "No inputs were found in config file...". Maybe I inadvertently fixed it somehow without knowing. Sorry for the confusion and thanks for the reply!

@mhegazy mhegazy closed this as completed Apr 19, 2017
HRK44 added a commit to HRK44/tfjs-core that referenced this issue Jun 13, 2018
Add 'dist' directory to remove some TS compilation error.
See microsoft/TypeScript#13656 for more info
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants