Warnings when using an exported interface in a class
1. OS
Arch Linux
Linux maistho-laptop 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux
2. Versions
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.5.0
os: linux x64
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 Terminal
4. The log given by the failure
Hash: 354e709ba2cf588db59a
Version: webpack 2.1.0-beta.21
Time: 11161ms
Asset Size Chunks Chunk Names
main.bundle.js 2.51 MB 0, 2 [emitted] main
styles.bundle.js 10.2 kB 1, 2 [emitted] styles
inline.js 5.53 kB 2 [emitted] inline
main.map 3.1 MB 0, 2 [emitted] main
styles.map 14.1 kB 1, 2 [emitted] styles
inline.map 5.59 kB 2 [emitted] inline
index.html 489 bytes [emitted]
assets/.npmignore 0 bytes [emitted]
chunk {0} main.bundle.js, main.map (main) 2.46 MB {1} [initial] [rendered]
chunk {1} styles.bundle.js, styles.map (styles) 9.96 kB {2} [initial] [rendered]
chunk {2} inline.js, inline.map (inline) 0 bytes [entry] [rendered]
WARNING in ./src/app/app.component.ts
18:55 export 'TestInterface' was not found in './test.service'
WARNING in ./src/app/app.component.ts
18:88 export 'TestInterface' was not found in './test.service'
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 2.82 kB 0
chunk {0} index.html 357 bytes [entry] [rendered]
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.
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?
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!
https://github.com/webpack/webpack/issues/7378
In my case, restarting ng serve helped. I had only one export in my ts file
I just restarted the server and the warnings are gone.
This is not an issue anymore. I used abstract class instead.
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 8.0.4 / 0.800.4
https://github.com/angular/angular-cli/issues/2034#issuecomment-249813801 fixed it for me
Having this issue after upgrading to angular 8
Having this issue after upgrading to angular 8
Just move out app the interface/types from the problematic file into a separate *.ts file and don't add the actual code there.
@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. <filename>.types.ts and export all of them. Also this file should not contain any real code e.g. classes, functions, variable etc.
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 export * from.
@jeffwhelpley I just added | null which fixed the issue for me
Why is angular/typescript making it hard for us? 😞
same as @mpgo13. I started getting the issue when updated to version 8.0.4 / 0.800.4,
But in my case #2034 (comment) didn't work for me.
Error is not just happening within my own libs, but also in one of the ngrx libraries
@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 8.0.4 / 0.800.4, see https://github.com/angular/angular-cli/issues/14876. A fix seems to be coming in the next release.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.