Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2, Visual studio 2015 update 1, Type Script Configuration

For the past week I have been trying to configure and start a very simple project using the following config:

Angular 2, Visual studio 2015 update 1, Type Script Configuration

I have a tsconfig.Json in root of my project with following content:

{
    "compilerOptions": {
        "rootDir": "src",
        "outDir": "web/js",
        "target": "es5",
        "module": "system",
        "declaration": false,
        "noImplicitAny": false,
        "removeComments": true,
        "noLib": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "sourceMap": true,
        "listFiles": true
    },
    "exclude": [
        "wwwroot",
        "node_modules"
    ],
    "filesGlob": [
        "app/**/*.ts"
    ]
}

I can see the virtual project in Solution explorer, angular and all required packages are installed as mentioned in angular.io 5 minute tutorial (https://angular.io/guide/quickstart).

This is what I have in my App.ts:

import {bootstrap, Component} from 'angular2/angular2';
@Component({
    selector: 'my-app',
    template: '<h1>My First Angular 2 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);

The error I'm getting is:

Symbol 'component can not be properly resolved, probably its located in an inaccessible module'

Same config works in VS Code with no issues.

I would be thankful if you can show what am I missing.

Thanks.

like image 373
Alex Avatar asked Dec 02 '15 07:12

Alex


4 Answers

found a workaround for now, will contact the resharper support and share the response here.

User "ctrl+ alt + shift + 8" keyboard shortcut to disable resharper quickly. Even after this I was not getting intellisense,to fix that in resharper settings change Typescript intellisense to Visual studio.

After this 2 changes I don't get any fake error messages.

Hope this helps other people having the same issue.

like image 104
Alex Avatar answered Nov 05 '22 20:11

Alex


I've disabled resharpers typescript inspection for now as I'm using 2016.2.2 and it's still causing issue's with typescript 2.0.3 for me.

Resharper > Options > Code Inspection > Settings

Find 'File masks' (bottom right) and add *.ts

like image 21
MIP1983 Avatar answered Nov 05 '22 19:11

MIP1983


If you have Resharper -> Check your Resharper Typescript Language settings. After Update 1 Typescript may update to 1.7 on your project, but Resharper currently only detects to 1.6. The default setting is to Auto Detect causing errors.

like image 4
Jeff H Avatar answered Nov 05 '22 21:11

Jeff H


This was a bug in Resharper, which is fixed in Resharper 2016.1.

Try updating to the latest version, and be sure to set Resharper back to auto-detect the Typescript version if (like me) you set it to 1.6 manually.

like image 1
StriplingWarrior Avatar answered Nov 05 '22 19:11

StriplingWarrior