Mina Matta
Mina Matta

Reputation: 1064

Angular Typescript libraries suddenly not compiling in Visual Studio

While I was developing Angular 4 application using Visual Studio, I tried to install and uninstall some Angular libraries. And suddenly I found the following compilation errors in visual studio

Severity    Code    Description Project File    Line    Suppression State
Error   TS2300  Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.es2015.core.d.ts  21  Active
Error   TS2403  Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.    TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  620 Active
Error   TS2403  Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.    TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  620 Active
Error   TS2403  Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  606 Active
Error   TS2403  Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  606 Active
Error   TS2300  Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.es2015.core.d.ts  21  Active
Error   TS2300  Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  7   Active
Error   TS2300  Duplicate identifier 'PropertyKey'. TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  7   Active
Error       Build:Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.  XX  XX\node_modules\@types\es6-shim\index.d.ts  620 
Error       Build:Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.    XX  XX\node_modules\@types\es6-shim\index.d.ts  606 
Error       Build:Duplicate identifier 'PropertyKey'.   XX  C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.3\lib.es2015.core.d.ts   21  
Error       Build:Duplicate identifier 'PropertyKey'.   XX  XX\node_modules\@types\es6-shim\index.d.ts  7   
Error       Build:All declarations of 'value' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  11  
Error       Build:All declarations of 'size' must have identical modifiers. XX  XX\node_modules\@types\es6-shim\index.d.ts  561 
Error       Build:All declarations of 'size' must have identical modifiers. XX  XX\node_modules\@types\es6-shim\index.d.ts  581 
Error       Build:All declarations of 'prototype' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  498 
Error       Build:All declarations of 'prototype' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  570 
Error       Build:All declarations of 'prototype' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  591 
Error       Build:All declarations of 'prototype' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  606 
Error       Build:All declarations of 'prototype' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  620 
Error       Build:All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers. XX  XX\node_modules\@types\es6-shim\index.d.ts  290 
Error       Build:All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers. XX  XX\node_modules\@types\es6-shim\index.d.ts  283 
Error       Build:All declarations of 'flags' must have identical modifiers.    XX  XX\node_modules\@types\es6-shim\index.d.ts  346 
Error       Build:All declarations of 'EPSILON' must have identical modifiers.  XX  XX\node_modules\@types\es6-shim\index.d.ts  248 
Error   TS2687  All declarations of 'value' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  11  Active
Error   TS2687  All declarations of 'value' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  11  Active
Error   TS2687  All declarations of 'size' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  561 Active
Error   TS2687  All declarations of 'size' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  561 Active
Error   TS2687  All declarations of 'size' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  581 Active
Error   TS2687  All declarations of 'size' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  581 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  498 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  498 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  570 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  570 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  591 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  591 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  606 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  606 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  620 Active
Error   TS2687  All declarations of 'prototype' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  620 Active
Error   TS2687  All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  290 Active
Error   TS2687  All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  290 Active
Error   TS2687  All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  283 Active
Error   TS2687  All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.   TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  283 Active
Error   TS2687  All declarations of 'flags' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  346 Active
Error   TS2687  All declarations of 'flags' must have identical modifiers.  TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  346 Active
Error   TS2687  All declarations of 'EPSILON' must have identical modifiers.    TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  248 Active
Error   TS2687  All declarations of 'EPSILON' must have identical modifiers.    TypeScript Virtual Projects XX\node_modules\@types\es6-shim\index.d.ts  248 Active

How do I fix these compilation errors?

Upvotes: 0

Views: 600

Answers (2)

nishant kaushik
nishant kaushik

Reputation: 11

I was also getting the same issue after banging my head for so long I got this solution

please remove any reference if you have imported in component

I have just removed one reference

import { Object } from 'es6-shim';

and it started to work again

best of luck :)

Upvotes: 1

Mina Matta
Mina Matta

Reputation: 1064

I have fixed these compilation errors by Deleting the npm packages from my visual studio project and re-install them again as following

  1. Go to web project folder and delete "node_modules" folder
  2. Open windows command as administrator
  3. write cd "{project folder path that contains package.json}"
  4. then write npm install

Upvotes: 1

Related Questions