Skip to content

Typescript Intellisense not working (using Angular4 project) #30003

Closed

Description

I have set up an Angular project however TypeScript Intellisense is not working. Similar to #21630 (closed).

  • VSCode Version: 1.13.1
  • OS Version: Windows 10 (1703)

Steps to Reproduce:

  1. Install Angular4: npm install -g @angular/cli
  2. Create Angular App: ng new my-app
  3. Initialise an array: items = ["Angular 4", "React", "Underscore"];

Edit: Additional steps
4. Typed this.items. but did not get Intellisense.
4. Typed items. but did not get Intellisense.

Edit: Reproduces without extensions: Yes

Activity

  1. zaakiy commented on Jul 2, 2017

    @zaakiy
    Author

    Screenshot:
    image

  2. cpamp commented on Jul 2, 2017

    @cpamp

    Sometimes intellisense stops working for me as well but closing and reopening vscode fixes it.

  3. mjbvz commented on Jul 3, 2017

    @mjbvz
    Contributor

    Zaakiy Siddiqui (@zaakiy) Where is items declared? Can you share the entire source file?

  4. zaakiy commented on Jul 6, 2017

    @zaakiy
    Author

    More info: played around and found that the problem is reproducible when the code is not inside a constructor. (Intellisense works if inside a constructor).

    Here is the code from the top:

    // filename: app.component.ts
    import { Component } from '@angular/core';
    
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.css']
    })
    
    export class AppComponent {
        items = [ 'Angular 4', 'React', 'Underscore'];
        // snipped
    }

    Edit: I would still like to know if Intellisense is supported outside the constructor, and if so, how to enable that functionality.

  5. mjbvz commented on Jul 7, 2017

    @mjbvz
    Contributor

    Zaakiy Siddiqui (@zaakiy) Thanks. I've opened microsoft/TypeScript#17026 to track this upstream

    As a workaround, change your code to use method syntax:

     class AppComponent {
        items = [ 'Angular 4', 'React', 'Underscore'];
    
        foo() {
            return this.items
        }
    }
  6. added
    upstreamIssue identified as 'upstream' component related (exists outside of VS Code)
    and removed
    info-neededIssue requires more information from poster
    on Jul 7, 2017
  7. zaakiy commented on Jul 7, 2017

    @zaakiy
    Author
  8. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

javascriptJavaScript support issuesupstreamIssue identified as 'upstream' component related (exists outside of VS Code)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions