Skip to content

Issues with importing interfaces created with export interface in Angular and TypeScript 3.9.6 #18170

Description

@stiezinger

Description

Recently I switched from Angular 9 to 10. On a new project I have issues to import interfaces automatically. For example I want to import this interface to my app.component.ts:


export interface TestInterface {
    string: name;
}

It is located in src/app/testInterface.ts. When i try to import it in my app.component.ts:


test: testInterface;

I am using VSC and IntelliSense is not showing me the option to autoimport/import the interface anymore. When i press Ctrl+. for Quick Fix I receive the message: No code actions available. In Angular 9 with Typescript 3.8.3 everything works fine, IntelliSense shows me the autoimport option or I can import the interface with Ctrl+. Key Binding. If I manually add the import it works:


import { testInterface } from 'src/app/testInterface';

🔬 Reproduction

To reproduce this issue try to install the latest angular/cli (at the moment of writing v10.0.1):


npm i @angular/cli@10.0.1 -g

Then create a new project:


ng new

Name it as you wish, I have enabled routing and choosen CSS for stylesheets.

When you install Angular 9 and create an project:


npm i @angular/cli@9.1.10 -g

ng new

Everything works as it should

🌍 Environment

My Environment is:


    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.0.1
Node: 12.18.0
OS: win32 x64

Angular: 10.0.2
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.1
@angular-devkit/build-angular     0.1000.1
@angular-devkit/build-optimizer   0.1000.1
@angular-devkit/build-webpack     0.1000.1
@angular-devkit/core              10.0.1
@angular-devkit/schematics        10.0.1
@angular/cdk                      10.0.1
@angular/cli                      10.0.1
@angular/material                 10.0.1
@ngtools/webpack                  10.0.1
@schematics/angular               10.0.1
@schematics/update                0.1000.1
rxjs                              6.5.5
typescript                        3.9.6
webpack                           4.43.0

Visual Studio Code Version 1.46.1

Activity

  1. self-assigned this
    on Jul 7, 2020
  2. modified the milestone: needsTriage on Jul 7, 2020
  3. added
    freq1: lowOnly reported by a handful of users who observe it rarely
    and removed
    freq1: lowOnly reported by a handful of users who observe it rarely
    on Jul 7, 2020
  4. modified the milestones: needsTriage, Backlog on Jul 7, 2020
  5. alan-agius4 commented on Jul 7, 2020

    @alan-agius4
    Collaborator
  6. added 2 commits that reference this issue on Aug 12, 2020
    8b96e52
    8fb5259
  7. angular-automatic-lock-bot commented on Sep 12, 2020

    @angular-automatic-lock-bot

    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.

  8. locked and limited conversation to collaborators on Sep 12, 2020
  9. added 2 commits that reference this issue on May 29, 2026
    81ab896
    58fb251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions