-
Notifications
You must be signed in to change notification settings - Fork 12k
updating CLI from 6.1.5 -> 7.0.3 indicates missing tsconfig files for ng serve / test (Karma) #12794
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
Comments
@michahell what was the original error that you experienced before adding the files in the The latest error that you are experiencing is legit and is working as expected as libraries should not contain any TypeScript files and has been the case even for version 6. |
@alan-agius4 |
And should I not be allowed to do whatever I want in my libraries? Why is it prohibited to import |
@michahell you certainly can do whatever you want in your libraries, but it is important to understand the implications of shipping typescript files. When you ship typescript files in a library, and import them from application typescript code, then the build system for your application is the one that will be building the library typescript files. Configuration might be required for that to work, especially on the tsconfig file. It's obvious enough that TS syntax that was introduced on newer versions won't work on older versions. But Typescript does not follow semver, and can introduce breaking changes in minors. So there is no real guarantee that TS syntax will be valid on upcoming versions. E.g. that what is valid under 3.0 is also valid in 3.1. So all in all if you ship TS in a library for consumers to build, then the consumers will have to build it using the same TS version as the library is developed in. This is often reasonable enough for internal libraries. It's definitely not prohibited to import For most of CLI 1.x we had a bug where we didn't really pay attention to the files listed in the tsconfig and just compiled all TS files that we came across. That changed in 1.5 and we started emitting That should have been in place throughout all 6.x releases. So I'm not really sure of why you're seeing errors in 7.x but not in 6.x. I think there is a bug somewhere, perhaps an error that is being swallowed. To figure out what's happening we'll need a reproduction, which you seem to be working on already. |
@filipesilva Thank you for your elaborate answer, this all makes sense. our use case is indeed usage as |
Here is a reproduction of what I'm experiencing.
(side question: why do I have to explicitly include
|
We are currently seeing a similar issue. After upgrading, we found that our application seems to work fine, but our local test infrastructure fails because of the same @michahell Are you guys symlinking your custom typings into place or are you actually installing the files into |
@mko Thanks for the feedback! We are really installing them as a package into |
@michahell I'm trying to use your repro but I can't see the error you mentioned. This is what I did:
I cannot see the error you mentioned ( Can you provide me with precise instructions that I can follow to see the error please? To make sure it is reproducible, try following the repro yourself by doing the instructions. |
@filipesilva ok will see what is going wrong, but the steps you followed should be correct... |
OK for some reason, a default Angular CLI project defaults to yarn for me, I don't know why, I just used npm for this MWE. What I did to make it 'work':
|
@michahell following your steps this is what I see:
I see the build failing on both If you change your
to
Then I'm not sure what the error on build is but since you say you're not seeing it yourself then I suppose it's some odd artifact of the repro. |
I would also dismiss the Maybe this is exáctly the problem i.e. - it does inherit although now the path is incorrect, because of the one directory level difference. |
When a property (like |
ah... that makes sense. I'd expected they would have been merged so no duplicating things / having a harder time maintaining. and indeed, that seems to fix it, and then I have to be able to change this in our project, too. |
I just really cannot seem to get this working in our project, really weird. What I've done now is add these 3 separate TS files the Angular compiler keeps complaining about in
because adding the folder to the
I still don't know why this is needed. But at least we can now continue working with Angular 7... 🤷♂️ |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
node: v9.8.0
npm: 6.4.1
ng: 7.0.3
os: macOS Mojave
Repro steps
In our Angular app we use a library consisting of only
.ts
files. these are mostly typings (so we should maybe use.d.ts
as suffix, but without this compilation worked fine in Angular 6.1.5.After upgrading, for 3 out of 36
.ts
files we get errors looking like the one in the log section below.After including the
include
property in ourtsconfig.json
file:we get the same error for our
main.ts
andpolyfills.ts
files. After adding also these files, that fixes compilation forng serve
andng build
. Forng test
(with Karma) however, we still get the same errors, even though ourtsconfig.spec.json
extendstsconfig.json
.Will try to come up with an MWE, WIP
The log given by the failure
Desired functionality
compilation succeeds as before in 6.1.7
The text was updated successfully, but these errors were encountered: