Skip to content

problem with @types/angular #9781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lucamorelli opened this issue Jul 17, 2016 · 22 comments
Closed

problem with @types/angular #9781

lucamorelli opened this issue Jul 17, 2016 · 22 comments
Assignees
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@lucamorelli
Copy link

lucamorelli commented Jul 17, 2016

Hi, after I installed ts 2.0 beta, I created an asp.net core application and added angular 1.5 and .d.ts from npm.
If I try to compile I have a few problems with angular-mocks.d.ts.
I see these errors in the error list

Cannot find name 'IServiceProvider'.    ... node_modules\@types\angular\angular-mocks.d.ts  65  
Cannot find name 'IScope'.  ..\node_modules\@types\angular\angular-mocks.d.ts   122 
Build:Module 'angular' has no exported member 'IInjectStatic'.  ...\node_modules\@types\angular\angular-mocks.d.ts  344 

If I open angular-mocks.d.ts at the beginning I find this
error

this could explain the errors, but:

  1. I don't understand why this error isn't shown in the error list
  2. this is my config file
{
  "compilerOptions": {
    "module": "system",
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "inlineSources": true,
    "inlineSourceMap": true,
    "outFile": "js/application.js"
  },
  "exclude": [
    "node_modules",
    "wwwroot",
    "node_modules/@types/angular/angular-mocks.d.ts"
  ]
}

same problems in the index.d.ts

// Support AMD require
export = angular;
here I have the same error.

how can I solve this?

@mhegazy mhegazy added the @types Relates to working with .d.ts files (declaration/definition files) from DefinitelyTyped label Jul 17, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jul 17, 2016

There a few issues with the @angular declarations, should all be fixed in the next few days. here are related issues:

@RyanCavanaugh RyanCavanaugh self-assigned this Jul 18, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jul 18, 2016

i pushed a fix for this to DefinitelyTyped/DefinitelyTyped#10170, once merged and published to npm I will let you know.

@lucamorelli
Copy link
Author

thanks

@lucamorelli
Copy link
Author

lucamorelli commented Jul 19, 2016

I just updated to @types/angular 1.5.8 and now I have no error.
Just another thing: if by mistake I have both

"sourceMap": true,
and

    "inlineSources": true,
    "inlineSourceMap": true,

ts compiler fails with this message

Error MSB6006 "tsc.exe" exited with code 1. HotelPerformance C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets 223 Build

@lucamorelli
Copy link
Author

lucamorelli commented Jul 19, 2016

Another thing, I have a similar problem adding the types file for angular-ui-bootstrap and ui-grid.

error

@lucamorelli
Copy link
Author

opening the angular index.d.ts file I still have this error message:

error

This happens only inside the editor, but there is not a compilation error

@mhegazy
Copy link
Contributor

mhegazy commented Jul 19, 2016

Just another thing: if by mistake I have both "sourceMap": true, and "inlineSourceMap", ts compiler fails with this message

Can you share the output in the output window?

opening the angular index.d.ts file I still have this error message:

I have filed #9829 to track this

@lucamorelli
Copy link
Author

error

any suggestion for the problem with the angular-ui-bootstrap and ui-grid problem?

@mhegazy
Copy link
Contributor

mhegazy commented Jul 19, 2016

i want the actual error. it should be in your output window after you build. or share the msbuild log using msbuild /verbosity:detailed

@lucamorelli
Copy link
Author

hmmm ... I don't find anything in the output window. How can I add parameters to msbuild in a asp.net core projects? I tried adding it to the Condination Compilation symbols but nothing changed.
FYI, in the error list, if I show Build+Intellisense I find

error

@mhegazy
Copy link
Contributor

mhegazy commented Jul 20, 2016

The extra errors should not be there. this is tracked by #9662

@mhegazy
Copy link
Contributor

mhegazy commented Jul 20, 2016

To get the build output go to Tools -> Options -> Projects and Solutions -> Build and Run and select MSBuild project build output verbosity to be Detailed

@lucamorelli
Copy link
Author

this happens when I compile with sourceMap in the ts config but not the .d.ts files give me problems

Target "PreComputeCompileTypeScriptWithTSConfig" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets" from project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\HotelPerformance.xproj" (target "CompileTypeScriptWithTSConfig" depends on it):
       Using "VsTsc" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.tasks.dll".
       Task "VsTsc"
         C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\tsconfig.json" --listEmittedFiles
       Done executing task "VsTsc".
Done building target "PreComputeCompileTypeScriptWithTSConfig" in project "HotelPerformance.xproj".
Target "CompileTypeScriptWithTSConfig" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets" from project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\HotelPerformance.xproj" (target "Compile" depends on it):
       Task "VsTsc"
         C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\tsconfig.json" --listEmittedFiles
         D:\Sorgenti\HotelPerformance\src\HotelPerformance\error TS5053:Build:Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(223,5): error MSB6006: "tsc.exe" exited with code 1.
       Done executing task "VsTsc" -- FAILED.
Done building target "CompileTypeScriptWithTSConfig" in project "HotelPerformance.xproj" -- FAILED.

if I reinstall them and retry this is the result

Target "CompileTypeScriptWithTSConfig" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets" from project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\HotelPerformance.xproj" (target "Compile" depends on it):
       Task "VsTsc"
         C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\tsconfig.json" --listEmittedFiles
         D:\Sorgenti\HotelPerformance\src\HotelPerformance\error TS5053:Build:Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
D:\Sorgenti\HotelPerformance\src\HotelPerformance\node_modules\@types\angular-ui-bootstrap\index.d.ts(8,26): error TS2307: Build:Cannot find module 'angular'.
D:\Sorgenti\HotelPerformance\src\HotelPerformance\node_modules\@types\ui-grid\index.d.ts(20,21): error TS2307: Build:Cannot find module 'angular'.
         The command exited with code 1.
       Done executing task "VsTsc" -- FAILED.
Done building target "CompileTypeScriptWithTSConfig" in project "HotelPerformance.xproj" -- FAILED.

Could be possible has problem to parse error rows without filename? honestly this error attached to the ending \ is a bit confusing

@mhegazy
Copy link
Contributor

mhegazy commented Jul 20, 2016

The error message is expected. the problem is the message is not well formatted:

D:\Sorgenti\HotelPerformance\src\HotelPerformance\error TS5053:Build:Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.

so VS can not parse it and put it in the error list, so you get the cryptic "tsc.exe" exited with code 1 message instead.

@lucamorelli
Copy link
Author

ok, so I think I can't do anything else in this situation

@mhegazy
Copy link
Contributor

mhegazy commented Jul 21, 2016

no, it is a bug and we need to fix it :)

@lucamorelli
Copy link
Author

ok, can you give me some advice about the problem with the angular-ui-bootstrap and ui-grid .d.ts files?

@mhegazy
Copy link
Contributor

mhegazy commented Jul 21, 2016

i am not sure i understand the issue with angular-ui-bootstrap and ui-grid. they are both working for me fine

@mhegazy
Copy link
Contributor

mhegazy commented Jul 21, 2016

MSBuild error reporting tracked by #9878

@lucamorelli
Copy link
Author

this is the package,json

{
  "version": "1.0.0",
  "name": "asp.net",
  "private": true,
  "devDependencies": {
    "@types/angular": "^1.5.8",
    "@types/angular-ui-bootstrap": "^0.13.30",
    "@types/ui-grid": "^0.0.29",
    "del": "^2.2.1",
    "gulp": "^3.9.1"
  },
  "dependencies": {
    "angular": "^1.5.7",
    "bootstrap": "^3.3.6",
    "jquery": "^2.2.4",
    "jquery-validation": "^1.15.0",
    "jquery-validation-unobtrusive": "^3.2.6",
    "angular-ui-bootstrap": "^1.3.3",
    "angular-ui-grid": "^3.2.6"
  }
}

this is the tsconfig.json

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "amd",
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "target": "es5",
    "inlineSources": true,
    "inlineSourceMap": true,
    "sourceMap": true,
    "outFile": "wwwroot/js/application.js"
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

this is the compilation log

Target "CompileTypeScriptWithTSConfig" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets" from project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\HotelPerformance.xproj" (target "Compile" depends on it):
       Task "VsTsc"
         C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\tsconfig.json" --listEmittedFiles
D:\Sorgenti\HotelPerformance\src\HotelPerformance\node_modules\@types\angular-ui-bootstrap\index.d.ts(8,26): error TS2307: Build:Cannot find module 'angular'.
D:\Sorgenti\HotelPerformance\src\HotelPerformance\node_modules\@types\ui-grid\index.d.ts(20,21): error TS2307: Build:Cannot find module 'angular'.
         The command exited with code 1.
       Done executing task "VsTsc" -- FAILED.
Done building target "CompileTypeScriptWithTSConfig" in project "HotelPerformance.xproj" -- FAILED.
Target "CompileTypeScriptWithTSConfig" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets" from project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\HotelPerformance.xproj" (target "Compile" depends on it):
       Task "VsTsc"
         C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --project "D:\Sorgenti\HotelPerformance\src\HotelPerformance\tsconfig.json" --listEmittedFiles
D:\Sorgenti\HotelPerformance\src\HotelPerformance\node_modules\@types\angular-ui-bootstrap\index.d.ts(8,26): error TS2307: Build:Cannot find module 'angular'.
D:\Sorgenti\HotelPerformance\src\HotelPerformance\node_modules\@types\ui-grid\index.d.ts(20,21): error TS2307: Build:Cannot find module 'angular'.
         The command exited with code 1.
       Done executing task "VsTsc" -- FAILED.
Done building target "CompileTypeScriptWithTSConfig" in project "HotelPerformance.xproj" -- FAILED.

@lucamorelli
Copy link
Author

lucamorelli commented Jul 22, 2016

could be that I have to add "moduleResolution": "node" to the tsconfig.json?
now seems to work

@mhegazy
Copy link
Contributor

mhegazy commented Jul 22, 2016

aah. that is it. this is tracked by #9831. for now you need to specify the "node" module resolution explicitly.

@RyanCavanaugh RyanCavanaugh added External Relates to another program, environment, or user action which we cannot control. and removed @types Relates to working with .d.ts files (declaration/definition files) from DefinitelyTyped labels Aug 15, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

3 participants