0

I've just installed ionic, cordova, and created an empty project. Everytime I launch ionic serve it displays browser page with Typescript errors like this:

**Typescript Error**

All declarations of 'size' must have identical modifiers.
node_modules/typescript/lib/lib.es2015.collection.d.ts
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value: V): this;
Typescript Error
All declarations of 'prototype' must have identical modifiers.
node_modules/typescript/lib/lib.es2015.collection.d.ts
new (): WeakMap<object, any>;
new <K extends object, V>(entries?: [K, V][]): WeakMap<K, V>;
readonly prototype: WeakMap<object, any>;

I have searched through the internet, and haven't found any solutions ( Ionic info log:

global packages:

@ionic/cli-utils : 1.4.0
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.12
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework                 : ionic-angular 3.5.0

System:

Node       : v7.2.0
OS         : OS X El Capitan
Xcode      : Xcode 8.2.1 Build version 8C1002 
ios-deploy : not installed
ios-sim    : not installed
npm        : 4.1.1 
1
  • what is your typescript version? Commented Jul 7, 2017 at 7:22

1 Answer 1

1

Not sure if this is a correct solution, what I did is in tsconfig.json I set the types to empty array:

"compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5",
    "types": []

Also this guys suggested to install typings lodash (npm install @types/lodash --save-dev --save-exact) https://stackoverflow.com/a/44032856/4984738

then I set "types": ["lodash"], which is also works. Please give any comments if there is a better solution. Because in my other project it doesnt resolve all the issues, not sure its a project issues or still due to the typescript

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.