-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Warnings when using an exported interface in a class #2034
Comments
I get same issue when following the the dependency injection token example given in the angular docs - https://angular.io/docs/ts/latest/guide/dependency-injection.html#dependency-injection-tokens Haven't checked if perhaps the docs have been updated but implemented in my app based on documentation as of maybe 2 months ago I get the following warning: Works fine despite warning so I've just been waiting for it to go away eventually as things mature |
@TheLarkInn can you weight in? |
Seeing the very same error as well. |
This is a bug we identified but I need to find it in our webpack repo to link to this one. |
having the same issue. (Works fine despite warning) meaning if i had one file with multiple exports - i got warnings in build (export 'MyInterface1' was not found in '../file')
after refactor - no warning
|
Usually (and coming from the Java world), I'd consider it good style to split such multiple definitions into separate files anyway. |
This issue is fixed for me after upgrading to angular-cli 1.0.0-beta.17 and angular 2.1.0 |
@teledemic interesting, I still have the same problem on those versions. |
Huh! I recently upgraded all my packages. Not sure what it could have been other than those two. FWIW:
|
I'm on Angular 2.1.0 and CLI beta 17. I have a structure looking like this:
which triggers a Warning:
If I make the AppConfig a class, it works without warnings. (Though of course it then has to be instantiated differently). |
Same issue with @input property decorator. Found workaround:
instead of
now no warnings |
Can anybody update on the status of this?. I'm at v1.0.0-beta.21, and still getting the warnings. |
I get an error in CLI: Cannot find name 'HERO_DI_CONFIG'. (followed complete example on angular documentation). Despite the error, all is working fine an chrome console doesn't log any errors. |
Just to add what knowledge I can, if you are using the APP_CONFIG example and getting the harmony warning, I moved the interface declaration (and just the interface declartion) into another file (iapp.config.ts),
imported IAppConfig into app.config.ts (since it is now in another file), and did the imports in the components separately, e.g:
Everything else remained the same (didn't have to convert it to a class etc). The extra file/imports are bulky, but no warnings and works as expected. |
Recently trying to create a service provider (yup, also following the DI guide at https://angular.io/docs/ts/latest/guide/dependency-injection.html#!#injector-providers) and I copied the code into the hero.service.provider.ts file. It seems that it demands the file to export CamelCase instead of camelCase. |
Took @Maistho repo for a spin. After Hash: cad6eef25bd1670f6646
Time: 10163ms
chunk {0} main.bundle.js, main.bundle.map (main) 5.23 kB {2} [initial] [rendered]
chunk {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 1.77 kB {3} [initial] [rendered]
chunk {2} vendor.bundle.js, vendor.bundle.map (vendor) 2.61 MB [initial] [rendered]
chunk {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
WARNING in ./src/app/app.component.ts
18:55-68 "export 'TestInterface' was not found in './test.service'
WARNING in ./src/app/app.component.ts
18:88-101 "export 'TestInterface' was not found in './test.service'
__ _ _ __ __ _ _ _ | | __ _ _ __ ___ | |() |
I still have this warning, as @catull reported. The current workaround that @Iverson suggested works for me. It can also be written as: |
I'd really like to see this resolved |
I am still experiencing exactly the issue described by @wulfsberg.
Everything works, but I get this warning:
As this seems to be legal (and recommended) code, it would be better if it did not throw a warning. |
There is simpler & better solution: move all interfaces in a relevant `myfunctionality.interfaces.ts' with a normal exports
and it works like a charm, with no warnings. And it separates your interfaces into their own files, which is nice. |
This issue is very annoying. |
Why is it closed? |
Still seeing the issue for Angular CLI v1.6.3. Why is it closed? |
This issue is happening. I have a one big ts file with many interfaces defined. Only two of those interfaces are causing this warning during build. However I'm able to import the interfaces just fine and intellisense is working for the affected interfaces. The stack trace shows the warning is triggered by the cli package. I assume this is ok to ignore as long as it build properly? |
yes @yangwen2 |
In case anyone's looking for it, this appears to be the upstream webpack issue that @TheLarkInn mentioned! |
In my case, restarting |
I just restarted the server and the warnings are gone. |
This is not an issue anymore. I used abstract class instead. |
is there any impact on types if we change interface to abstract class |
Got this issue today when updating angular's packages to #2034 (comment) fixed it for me |
Having this issue after upgrading to angular 8 |
Just move out app the interface/types from the problematic file into a separate |
@th0r do you mean the interface thats causing the issue to remove them and put them into there own separate file |
@hijazikaram yes. In my projects in case of such errors I just move all the interfaces/types from the file that triggers an error into a separate file e.g. |
Same issue. Moving interface to a separate file doesn't help if use barrel. |
Same issue. really don't want to move interfaces to separate files. Also, issue for aggregator ts files that do a lot of |
@jeffwhelpley I just added | null which fixed the issue for me |
Why is angular/typescript making it hard for us? 😞 |
@tbnovaes I got the same issue few days ago. After setting the fixed version of angular devDependencies to 8.0.0 / 0.800.0 it was gone. |
For those of you who got this error after upgrading to |
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. |
1. OS
Arch Linux
2. Versions
3. Repro steps
I started a new repository, and added a new empty service, with an exported interface.
Complete changes, and a repo to pull and see the issue, can be found here:
https://github.com/Maistho/angular-cli-input-issue/commit/e5c483081bfd7af3dafd0db074179b3090668e27
After running
ng build
, I get two warnings in the Terminal4. The log given by the failure
5. Mention any other details that might be useful.
I could not reproduce the issue without adding the
@Input()
to the class member.Compiling with
tsc
does not produce any warnings.The text was updated successfully, but these errors were encountered: