Skip to content

Error when using exported interface #14876

Closed
@slubowsky

Description

@slubowsky

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 8.0.3

(See "anything else relevant" section, exact bug has appeared and been fixed before)

Description

A clear and concise description of the problem...

Using an exported interface produces an error, app is not served.

🔬 Minimal Reproduction

export an interface:

export interface AppConfig {..}
export let APP_CONFIG = new InjectionToken<AppConfig>('app.config');

Import it elsewhere:
import { APP_CONFIG, AppConfig } from '../app.config';
Use it:

export class MyService {
  constructor(@Inject(APP_CONFIG) config: AppConfig,...
  ...
}

🔥 Exception or Error

ng serve

ERROR in ./src/app/shared/my.service.ts 20:12-21
"export 'AppConfig' was not found in '../app.config'

App is not served. Havent tried build.

🌍 Your Environment

Angular CLI: 8.0.4
Node: 12.4.0
OS: win32 x64
Angular: 8.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.800.4
@angular-devkit/build-angular     0.800.4
@angular-devkit/build-optimizer   0.800.4
@angular-devkit/build-webpack     0.800.4
@angular-devkit/core              8.0.4
@angular-devkit/schematics        8.0.4
@angular/cli                      8.0.4
@angular/pwa                      0.800.4
@ngtools/webpack                  8.0.4
@schematics/angular               8.0.4
@schematics/update                0.800.4
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.30.0

Anything else relevant?
Had this exact issue almost 3 years ago - #2034 (comment). That issue has so many comments that I forget exactly how it was actually resolved, but it was, and warning eventually went away. Now its back.
At that time it was a warning and was ignorable. This time its an error and app is not served...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions