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

tns-platform-declarations 2.3.0 ERROR on build [iOS] #2724

Closed
NickIliev opened this Issue Sep 15, 2016 · 33 comments

Comments

Projects
None yet
@NickIliev
Member

NickIliev commented Sep 15, 2016

Adding the latest tns-platform-declarations throws with

node_modules/tns-platform-declarations/tns-core-modules/ios/objc-i386/objc!CoreAudio.d.ts(7,13): error TS2403: Subsequent variable declarations must have the sa
me type.  Variable 'AudioBuffer' must be of type '{ new (): AudioBuffer; prototype: AudioBuffer; }', but here has type 'StructType<AudioBuffer>'.

node_modules/tns-platform-declarations/tns-core-modules/ios/objc-i386/objc!UIKit.d.ts(4940,15): error TS2300: Duplicate identifier 'UIEvent'.

node_modules/tns-platform-declarations/tns-core-modules/ios/objc-i386/objc!UIKit.d.ts(4940,15): error TS2417: Class static side 'typeof UIEvent' incorrectly ext
ends base class static side 'typeof NSObject'.
  Types of property 'alloc' are incompatible.
    Type '() => UIEvent' is not assignable to type '() => NSObject'.
      Type 'UIEvent' is not assignable to type 'NSObject'.
        Property 'accessibilityActivationPoint' is missing in type 'UIEvent'.

node_modules/typescript/lib/lib.d.ts(14781,11): error TS2300: Duplicate identifier 'UIEvent'.

node_modules/typescript/lib/lib.d.ts(14787,13): error TS2300: Duplicate identifier 'UIEvent'.

Also a breaking change to the ios.d.ts path has been introduced and the path now is
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />

compared to the path in 2.2.0
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios.d.ts" />

@PanayotCankov

This comment has been minimized.

Show comment
Hide comment
@PanayotCankov

PanayotCankov Sep 16, 2016

Member

UIEvent is present both in the dom .d.ts in the typescript package and in iOS there is an UIEvent.
To resolve the issues, set "noLib": false in the tsconfig, and add a reference to './node_modules/typescript/lib/lib.core.es6.d.ts'. This will include the UIEvent from iOS and from the typescript plugin will use core declarations that have no dom specific classes.

Member

PanayotCankov commented Sep 16, 2016

UIEvent is present both in the dom .d.ts in the typescript package and in iOS there is an UIEvent.
To resolve the issues, set "noLib": false in the tsconfig, and add a reference to './node_modules/typescript/lib/lib.core.es6.d.ts'. This will include the UIEvent from iOS and from the typescript plugin will use core declarations that have no dom specific classes.

@NickIliev

This comment has been minimized.

Show comment
Hide comment
@NickIliev

NickIliev Sep 16, 2016

Member

references.d.ts

/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" /> 
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/org.nativescript.widgets.d.ts" /> 

/// <reference path='./node_modules/typescript/lib/lib.core.d.ts'/>

declare type FormData = any;
declare var FormData;
declare type Blob = any;
declare var Blob;

tsconfig.ts

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "sourceMap": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true,
        "noLib": true
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}
Member

NickIliev commented Sep 16, 2016

references.d.ts

/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" /> 
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/org.nativescript.widgets.d.ts" /> 

/// <reference path='./node_modules/typescript/lib/lib.core.d.ts'/>

declare type FormData = any;
declare var FormData;
declare type Blob = any;
declare var Blob;

tsconfig.ts

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "sourceMap": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true,
        "noLib": true
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}
@getmetorajesh

This comment has been minimized.

Show comment
Hide comment
@getmetorajesh

getmetorajesh Sep 26, 2016

Even after appending the above code, I get more errors,

    node_modules/@angular/core/src/testability/testability.d.ts(40,33): error TS2304: Cannot find name 'Node'.

node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(21,47): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(26,42): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(27,34): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(28,25): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(29,22): error TS2304: Cannot find name 'Event'.
.....
...

getmetorajesh commented Sep 26, 2016

Even after appending the above code, I get more errors,

    node_modules/@angular/core/src/testability/testability.d.ts(40,33): error TS2304: Cannot find name 'Node'.

node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(21,47): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(26,42): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(27,34): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(28,25): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(29,22): error TS2304: Cannot find name 'Event'.
.....
...
@stefalda

This comment has been minimized.

Show comment
Hide comment
@stefalda

stefalda commented Sep 27, 2016

Me too...

@berrylands

This comment has been minimized.

Show comment
Hide comment
@berrylands

berrylands Oct 12, 2016

Has anyone found a way to resolve this. I have spent days trying to do so in vain :(

berrylands commented Oct 12, 2016

Has anyone found a way to resolve this. I have spent days trying to do so in vain :(

@stefalda

This comment has been minimized.

Show comment
Hide comment
@stefalda

stefalda Oct 12, 2016

Sorry, I gave up and removed the declaration file... maybe you can try installing nativescript@next to check if it's fixed there...

stefalda commented Oct 12, 2016

Sorry, I gave up and removed the declaration file... maybe you can try installing nativescript@next to check if it's fixed there...

@marciovicente

This comment has been minimized.

Show comment
Hide comment
@marciovicente

marciovicente Oct 17, 2016

I change my reference.d.ts and not it's working fine :)

Also, I set noEmitOnError to false in tsconfig.json.

Before

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios.d.ts" /

After

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />

marciovicente commented Oct 17, 2016

I change my reference.d.ts and not it's working fine :)

Also, I set noEmitOnError to false in tsconfig.json.

Before

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios.d.ts" /

After

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />
@holymp2006

This comment has been minimized.

Show comment
Hide comment
@holymp2006

holymp2006 Oct 26, 2016

Hopefully, this should resolve the issue.

references.d.ts

/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es6.d.ts" /> 

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" />

declare type FormData = any;
declare var FormData;
declare type Blob = any;
declare var Blob;

Notice how I referenced tns-core-modules.es6.d.ts NOT tns-core-modules.d.ts

tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "sourceMap": true,
        "experimentalDecorators": true,
        "lib": [
            "es2016"
        ],
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

Notice I how I included "lib": [ "es2016" ]

This resolved the issue for me.

holymp2006 commented Oct 26, 2016

Hopefully, this should resolve the issue.

references.d.ts

/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es6.d.ts" /> 

/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" />

declare type FormData = any;
declare var FormData;
declare type Blob = any;
declare var Blob;

Notice how I referenced tns-core-modules.es6.d.ts NOT tns-core-modules.d.ts

tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "sourceMap": true,
        "experimentalDecorators": true,
        "lib": [
            "es2016"
        ],
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

Notice I how I included "lib": [ "es2016" ]

This resolved the issue for me.

@bm-software

This comment has been minimized.

Show comment
Hide comment
@bm-software

bm-software Oct 26, 2016

@holymp2006 I tried your solution and it worked but only if I put "outDir": "app" option in my tsconfig.json. Without that option, tns build command fails to compile with multiple Cannot find name 'X' errors like:

node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(11,26): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(12,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(13,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(14,16): error TS2304: Cannot find name 'Node'.
...
[many many other]

With "outDir": "app" option I can build and run my project without any errors but VS Code could not find modules references during development (showing an error in the file):

immagine

This is my tsconfig.json:

{
    "compilerOptions": { 
        "outDir": "app", 
        "module": "commonjs", 
        "target": "es6" ,
        "inlineSourceMap": true, 
        "removeComments": false, 
        "experimentalDecorators": true, 
        "emitDecoratorMetadata": true, 
        "noEmitHelpers": true,
        "noEmitOnError": true, 
        "noLib": false, 
        "lib": [ "es2016" ] 
    }, 
    "exclude": [ 
        "node_modules", 
        "platforms" 
    ] 
}

How can I solve this?

bm-software commented Oct 26, 2016

@holymp2006 I tried your solution and it worked but only if I put "outDir": "app" option in my tsconfig.json. Without that option, tns build command fails to compile with multiple Cannot find name 'X' errors like:

node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(11,26): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(12,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(13,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(14,16): error TS2304: Cannot find name 'Node'.
...
[many many other]

With "outDir": "app" option I can build and run my project without any errors but VS Code could not find modules references during development (showing an error in the file):

immagine

This is my tsconfig.json:

{
    "compilerOptions": { 
        "outDir": "app", 
        "module": "commonjs", 
        "target": "es6" ,
        "inlineSourceMap": true, 
        "removeComments": false, 
        "experimentalDecorators": true, 
        "emitDecoratorMetadata": true, 
        "noEmitHelpers": true,
        "noEmitOnError": true, 
        "noLib": false, 
        "lib": [ "es2016" ] 
    }, 
    "exclude": [ 
        "node_modules", 
        "platforms" 
    ] 
}

How can I solve this?

@holymp2006

This comment has been minimized.

Show comment
Hide comment
@holymp2006

holymp2006 Oct 26, 2016

@bm-software I haven't experienced this. Maybe because I don't use angular.
Anyway, add "rootDir": "." to your compilerOptions. I have a good feeling it'll fix your VSCode issue since you also have outDir set.

holymp2006 commented Oct 26, 2016

@bm-software I haven't experienced this. Maybe because I don't use angular.
Anyway, add "rootDir": "." to your compilerOptions. I have a good feeling it'll fix your VSCode issue since you also have outDir set.

@bm-software

This comment has been minimized.

Show comment
Hide comment
@bm-software

bm-software Oct 27, 2016

@holymp2006 Unfortunately also setting "rootDir": "." or "rootDir": "./" does not solve the VSCode issue :( But why setting the appDir options cause this problem?

bm-software commented Oct 27, 2016

@holymp2006 Unfortunately also setting "rootDir": "." or "rootDir": "./" does not solve the VSCode issue :( But why setting the appDir options cause this problem?

@holymp2006

This comment has been minimized.

Show comment
Hide comment
@holymp2006

holymp2006 Oct 27, 2016

@bm-software like I said, unfortunately, I don’t use angular. So, I might not be able to help you resolve this fully. Maybe someone else with more experience with declarations will come along. Meanwhile, see if this answer on SO gives you any pointers.

holymp2006 commented Oct 27, 2016

@bm-software like I said, unfortunately, I don’t use angular. So, I might not be able to help you resolve this fully. Maybe someone else with more experience with declarations will come along. Meanwhile, see if this answer on SO gives you any pointers.

@SamuelReeder

This comment has been minimized.

Show comment
Hide comment
@SamuelReeder

SamuelReeder Oct 28, 2016

this is what fixed it for me, in tsconfig.json setting "noEmitOnError": false, removed the errors and i am able to build again, this was in combination with this as my references.d.ts /// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation. /// <reference path="./node_modules/nativescript-plugin-firebase/firebase.d.ts" /> /// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" /> /// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" /> /// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/org.nativescript.widgets.d.ts" />

edit - however after doing so i noticed that VS cant find function, alert, and many other terms like this. It still runs, abut throws errors in VS where it should not be. Anyone have a fix for this? (this is because of "noEmitOnError": false,)

SamuelReeder commented Oct 28, 2016

this is what fixed it for me, in tsconfig.json setting "noEmitOnError": false, removed the errors and i am able to build again, this was in combination with this as my references.d.ts /// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation. /// <reference path="./node_modules/nativescript-plugin-firebase/firebase.d.ts" /> /// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/android17.d.ts" /> /// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" /> /// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/org.nativescript.widgets.d.ts" />

edit - however after doing so i noticed that VS cant find function, alert, and many other terms like this. It still runs, abut throws errors in VS where it should not be. Anyone have a fix for this? (this is because of "noEmitOnError": false,)

@bm-software

This comment has been minimized.

Show comment
Hide comment
@bm-software

bm-software Oct 29, 2016

@SamuelGRwebfab This "solve" the issue (iOS errors are obviously still present). I can build and run my project but now, if I run my prject with livesync, including tns-platform.declarations file, node launches the exception FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.

Is there any solution to this?

bm-software commented Oct 29, 2016

@SamuelGRwebfab This "solve" the issue (iOS errors are obviously still present). I can build and run my project but now, if I run my prject with livesync, including tns-platform.declarations file, node launches the exception FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory.

Is there any solution to this?

@SamuelReeder

This comment has been minimized.

Show comment
Hide comment
@SamuelReeder

SamuelReeder Oct 29, 2016

@bm-software For now i have removed my IOS reference because of this issue. Untill i find a proper solution. Sorry I cant point you in the right direction. If i find an answer I will post it here, but I imagine someone will find it before me.

SamuelReeder commented Oct 29, 2016

@bm-software For now i have removed my IOS reference because of this issue. Untill i find a proper solution. Sorry I cant point you in the right direction. If i find an answer I will post it here, but I imagine someone will find it before me.

@corne-de-bruin

This comment has been minimized.

Show comment
Hide comment
@corne-de-bruin

corne-de-bruin Nov 9, 2016

I'm experiencing the same issue with the upgrade to Nativescript 2.3.0.
I've discoverd that the compile issues are solved if you the "lib.core.d.ts" and "lib.dom.d.ts" from the tns-core-modules. But still haven't found a good solution or workaround for this.

corne-de-bruin commented Nov 9, 2016

I'm experiencing the same issue with the upgrade to Nativescript 2.3.0.
I've discoverd that the compile issues are solved if you the "lib.core.d.ts" and "lib.dom.d.ts" from the tns-core-modules. But still haven't found a good solution or workaround for this.

@SamuelReeder

This comment has been minimized.

Show comment
Hide comment
@SamuelReeder

SamuelReeder Nov 22, 2016

anyone found a fix for this yet?

SamuelReeder commented Nov 22, 2016

anyone found a fix for this yet?

@joshcomley

This comment has been minimized.

Show comment
Hide comment
@joshcomley

joshcomley Nov 26, 2016

Does anyone know how to correctly use the type definitions from NativeScript? I've tried every solution offered here and nothing works, always compilation errors like error TS2304: Cannot find name 'Node'.

joshcomley commented Nov 26, 2016

Does anyone know how to correctly use the type definitions from NativeScript? I've tried every solution offered here and nothing works, always compilation errors like error TS2304: Cannot find name 'Node'.

@NickIliev

This comment has been minimized.

Show comment
Hide comment
@NickIliev

NickIliev Nov 28, 2016

Member

Hey @joshcomley , @SamuelGRwebfab , @corne-de-bruin @bm-software

As a workaround add this to your references.d.ts


/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
 
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" 

declare type Location = any;
declare type Node = any;
declare type Document = any;
declare type History = any;
declare type HTMLElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Element = any;
declare type DocumentFragment = any;
declare type Text = any;
declare type HTMLDocument = any;
declare type HTMLAnchorElement = any;
declare type Comment = any;
declare type MouseEvent = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;

and your tsconfig.json should look like this:

{
    "compilerOptions": {
        "noEmitOnError": true,
        "noEmitHelpers": true,
        "sourceMap": true,
        "target": "es5",
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "noImplicitUseStrict": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "pretty": true,
        "lib": [
            "es2016"
        ]
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

The solution above is assuming you are creating NativeScript + Angular-2 application which is using NativeScript 2.4.0 and tns-platform-declarations 2.4.0

Member

NickIliev commented Nov 28, 2016

Hey @joshcomley , @SamuelGRwebfab , @corne-de-bruin @bm-software

As a workaround add this to your references.d.ts


/// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
 
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" 

declare type Location = any;
declare type Node = any;
declare type Document = any;
declare type History = any;
declare type HTMLElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Element = any;
declare type DocumentFragment = any;
declare type Text = any;
declare type HTMLDocument = any;
declare type HTMLAnchorElement = any;
declare type Comment = any;
declare type MouseEvent = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;

and your tsconfig.json should look like this:

{
    "compilerOptions": {
        "noEmitOnError": true,
        "noEmitHelpers": true,
        "sourceMap": true,
        "target": "es5",
        "module": "commonjs",
        "declaration": false,
        "noImplicitAny": false,
        "noImplicitUseStrict": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "pretty": true,
        "lib": [
            "es2016"
        ]
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

The solution above is assuming you are creating NativeScript + Angular-2 application which is using NativeScript 2.4.0 and tns-platform-declarations 2.4.0

@SamuelReeder

This comment has been minimized.

Show comment
Hide comment
@SamuelReeder

SamuelReeder Nov 28, 2016

@NickIliev

I just tried this work around and its throwing even more errors (copied your code exactly except i have a reference for firebase as well). My IDE is giving me an error on each declared type saying duplicate identifier. Here is the console error (not all of it)

node_modules/tns-core-modules/weakmap.d.ts(11,13): error TS2403: Subsequent vari
able declarations must have the same type. Variable 'WeakMap' must be of type '
WeakMapConstructor', but here has type 'new <K, V>() => WeakMap<K, V>'.

28     readonly size: number;
                ~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(28,14): error TS2687: All
 declarations of 'size' must have identical modifiers.


31 interface MapConstructor {
             ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(31,11): error TS2300: Dup
licate identifier 'MapConstructor'.


65     readonly size: number;
                ~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(65,14): error TS2687: All
 declarations of 'size' must have identical modifiers.


68 interface SetConstructor {
             ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(68,11): error TS2300: Dup
licate identifier 'SetConstructor'.


28     readonly iterator: symbol;
                ~~~~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(28,14): error TS2687: All d
eclarations of 'iterator' must have identical modifiers.


33     value: T;
       ~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(33,5): error TS2687: All de
clarations of 'value' must have identical modifiers.


118 interface MapConstructor {
              ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(118,11): error TS2300: Dupl
icate identifier 'MapConstructor'.


135 interface SetConstructor {
              ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(135,11): error TS2300: Dupl
icate identifier 'SetConstructor'.


76     readonly prototype: Promise<any>;
                ~~~~~~~~~

node_modules/typescript/lib/lib.es2015.promise.d.ts(76,14): error TS2687: All de
clarations of 'prototype' must have identical modifiers.


33     readonly prototype: Symbol;
                ~~~~~~~~~

node_modules/typescript/lib/lib.es2015.symbol.d.ts(33,14): error TS2687: All dec
larations of 'prototype' must have identical modifiers.

SamuelReeder commented Nov 28, 2016

@NickIliev

I just tried this work around and its throwing even more errors (copied your code exactly except i have a reference for firebase as well). My IDE is giving me an error on each declared type saying duplicate identifier. Here is the console error (not all of it)

node_modules/tns-core-modules/weakmap.d.ts(11,13): error TS2403: Subsequent vari
able declarations must have the same type. Variable 'WeakMap' must be of type '
WeakMapConstructor', but here has type 'new <K, V>() => WeakMap<K, V>'.

28     readonly size: number;
                ~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(28,14): error TS2687: All
 declarations of 'size' must have identical modifiers.


31 interface MapConstructor {
             ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(31,11): error TS2300: Dup
licate identifier 'MapConstructor'.


65     readonly size: number;
                ~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(65,14): error TS2687: All
 declarations of 'size' must have identical modifiers.


68 interface SetConstructor {
             ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.collection.d.ts(68,11): error TS2300: Dup
licate identifier 'SetConstructor'.


28     readonly iterator: symbol;
                ~~~~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(28,14): error TS2687: All d
eclarations of 'iterator' must have identical modifiers.


33     value: T;
       ~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(33,5): error TS2687: All de
clarations of 'value' must have identical modifiers.


118 interface MapConstructor {
              ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(118,11): error TS2300: Dupl
icate identifier 'MapConstructor'.


135 interface SetConstructor {
              ~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.es2015.iterable.d.ts(135,11): error TS2300: Dupl
icate identifier 'SetConstructor'.


76     readonly prototype: Promise<any>;
                ~~~~~~~~~

node_modules/typescript/lib/lib.es2015.promise.d.ts(76,14): error TS2687: All de
clarations of 'prototype' must have identical modifiers.


33     readonly prototype: Symbol;
                ~~~~~~~~~

node_modules/typescript/lib/lib.es2015.symbol.d.ts(33,14): error TS2687: All dec
larations of 'prototype' must have identical modifiers.
@NickIliev

This comment has been minimized.

Show comment
Hide comment
@NickIliev

NickIliev Nov 29, 2016

Member

Hey @SamuelGRwebfab can you paste the content of your package.json, tsconfig.json and references.d.ts ? Note that you should have tns-core-modules 2.4.0 as a minimum version for this to work.

We have created sample Angular-2 application which you can use as a reference. In this application, we are using tns-platform-declarations with the solution posted above.

Member

NickIliev commented Nov 29, 2016

Hey @SamuelGRwebfab can you paste the content of your package.json, tsconfig.json and references.d.ts ? Note that you should have tns-core-modules 2.4.0 as a minimum version for this to work.

We have created sample Angular-2 application which you can use as a reference. In this application, we are using tns-platform-declarations with the solution posted above.

@corne-de-bruin

This comment has been minimized.

Show comment
Hide comment
@corne-de-bruin

corne-de-bruin Nov 29, 2016

Hey @NickIliev

Thanks for the workaround!

Since we are using rxjs: 5.0.0-beta12 we also had to include the following type declares:
declare type NodeList = any;
declare type HTMLCollection = any;
declare type MessageEvent = any;
declare type CloseEvent = any;
declare type WebSocket = any;

corne-de-bruin commented Nov 29, 2016

Hey @NickIliev

Thanks for the workaround!

Since we are using rxjs: 5.0.0-beta12 we also had to include the following type declares:
declare type NodeList = any;
declare type HTMLCollection = any;
declare type MessageEvent = any;
declare type CloseEvent = any;
declare type WebSocket = any;

@casche

This comment has been minimized.

Show comment
Hide comment
@casche

casche Dec 1, 2016

Hey @NickIliev,

Your changes fix our TSC errors but we're still experiencing

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

When using both android & iOS typings and --watch

casche commented Dec 1, 2016

Hey @NickIliev,

Your changes fix our TSC errors but we're still experiencing

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

When using both android & iOS typings and --watch

@tsonevn tsonevn added this to the 2.6.0 (TBD) milestone Dec 5, 2016

@hshristov hshristov modified the milestones: 2.5.0, 2.6.0 (TBD) Dec 5, 2016

@hshristov hshristov modified the milestones: 2.6.0 (TBD), 2.5.0 Jan 4, 2017

@Gerstalexej

This comment has been minimized.

Show comment
Hide comment
@Gerstalexej

Gerstalexej Jan 12, 2017

Hey @NickIliev,
I'm having the same problem as @SamuelGRwebfab , the workaround didn't solve the problem. I am NOT using Angular, just regular nativescript+typescript.

This is my package.json


> {
> 
>   "name": "tuerknecht",
>   "version": "1.0.0",
>   "description": "A IoS and Android app for managing acccess to your home via the *Türknecht*.",
>   "repository": {
>     "type": "git",
>     "url": "https://gitlab.com/alexej.gerstmaier/Tuerknecht-nativescript.git"
>   },
>   "keywords": [
>     "Türknecht"
>   ],
>   "author": "Alexej Gerstmaier <alexej@lackey.com> (http://lackey.eu)",
>   "license": "Proprietary",
>   "bugs": {
>     "url": "https://gitlab.com/alexej.gerstmaier/Tuerknecht-nativescript.git"
>   },
>   "homepage": "https://lackey.eu",
>   "nativescript": {
>     "id": "com.quonux.tuerknecht",
>     "tns-ios": {
>       "version": "2.6.0-2017-1-10-1"
>     },
>     "tns-android": {
>       "version": "2.4.1"
>     }
>   },
>   "dependencies": {
>     "email-validator": "^1.0.7",
>     "everlive-sdk": "^1.8.1",
>     "json-stringify-safe": "^5.0.1",
>     "knock-knock-jokes": "^1.7.0",
>     "moment": "^2.17.1",
>     "nativescript-drop-down": "^1.5.1",
>     "nativescript-floatingactionbutton": "^2.2.7",
>     "nativescript-push-notifications": "0.0.19",
>     "nativescript-social-share": "^1.3.1",
>     "tns-core-modules": "^2.4.4"
>   },
>   "devDependencies": {
>     "babel-traverse": "6.10.4",
>     "babel-types": "6.11.1",
>     "babylon": "6.8.2",
>     "lazy": "1.0.11",
>     "nativescript-dev-typescript": "^0.3.5",
>     "tns-platform-declarations": "^2.4.4",
>     "typescript": "^2.0.10"
>   }
> }
> 

tsconfig.json

{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true
},
"exclude": [
"node_modules",
"platforms"
]
}

references.d.ts


<reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> 
 <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
<reference path="./node_modules/tns-platform-declarations/android.d.ts" />

Thanks for the help!

Gerstalexej commented Jan 12, 2017

Hey @NickIliev,
I'm having the same problem as @SamuelGRwebfab , the workaround didn't solve the problem. I am NOT using Angular, just regular nativescript+typescript.

This is my package.json


> {
> 
>   "name": "tuerknecht",
>   "version": "1.0.0",
>   "description": "A IoS and Android app for managing acccess to your home via the *Türknecht*.",
>   "repository": {
>     "type": "git",
>     "url": "https://gitlab.com/alexej.gerstmaier/Tuerknecht-nativescript.git"
>   },
>   "keywords": [
>     "Türknecht"
>   ],
>   "author": "Alexej Gerstmaier <alexej@lackey.com> (http://lackey.eu)",
>   "license": "Proprietary",
>   "bugs": {
>     "url": "https://gitlab.com/alexej.gerstmaier/Tuerknecht-nativescript.git"
>   },
>   "homepage": "https://lackey.eu",
>   "nativescript": {
>     "id": "com.quonux.tuerknecht",
>     "tns-ios": {
>       "version": "2.6.0-2017-1-10-1"
>     },
>     "tns-android": {
>       "version": "2.4.1"
>     }
>   },
>   "dependencies": {
>     "email-validator": "^1.0.7",
>     "everlive-sdk": "^1.8.1",
>     "json-stringify-safe": "^5.0.1",
>     "knock-knock-jokes": "^1.7.0",
>     "moment": "^2.17.1",
>     "nativescript-drop-down": "^1.5.1",
>     "nativescript-floatingactionbutton": "^2.2.7",
>     "nativescript-push-notifications": "0.0.19",
>     "nativescript-social-share": "^1.3.1",
>     "tns-core-modules": "^2.4.4"
>   },
>   "devDependencies": {
>     "babel-traverse": "6.10.4",
>     "babel-types": "6.11.1",
>     "babylon": "6.8.2",
>     "lazy": "1.0.11",
>     "nativescript-dev-typescript": "^0.3.5",
>     "tns-platform-declarations": "^2.4.4",
>     "typescript": "^2.0.10"
>   }
> }
> 

tsconfig.json

{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true
},
"exclude": [
"node_modules",
"platforms"
]
}

references.d.ts


<reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> 
 <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
<reference path="./node_modules/tns-platform-declarations/android.d.ts" />

Thanks for the help!

@votiakov votiakov referenced this issue Jan 14, 2017

Closed

Request for IOS #5

@SamuelReeder

This comment has been minimized.

Show comment
Hide comment
@SamuelReeder

SamuelReeder Jan 30, 2017

@Gerstalexej

I was able to get my TSC to work (and it seems like everything else) by going into the app folder, then in the references.d.ts INSIDE OF THE APP FOLDER not root, change the reference to
/// <reference path="../node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />

Do not add the other references, this should be the only reference in the file.

If I find that this causes any issues i will post an update, hopefully with a fix for what ever issues crop up

SamuelReeder commented Jan 30, 2017

@Gerstalexej

I was able to get my TSC to work (and it seems like everything else) by going into the app folder, then in the references.d.ts INSIDE OF THE APP FOLDER not root, change the reference to
/// <reference path="../node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />

Do not add the other references, this should be the only reference in the file.

If I find that this causes any issues i will post an update, hopefully with a fix for what ever issues crop up

@alixandru

This comment has been minimized.

Show comment
Hide comment
@alixandru

alixandru Mar 2, 2017

@SamuelGRwebfab can you please post the content of your tsconfig.json and the 2 references.d.ts files? I followed your advice and I still get lots of errors when running tns prepare iOS. Thanks

alixandru commented Mar 2, 2017

@SamuelGRwebfab can you please post the content of your tsconfig.json and the 2 references.d.ts files? I followed your advice and I still get lots of errors when running tns prepare iOS. Thanks

@SamuelReeder

This comment has been minimized.

Show comment
Hide comment
@SamuelReeder

SamuelReeder Mar 3, 2017

@alixandru of course. Sorry for the delay

tnsconfig

{ "compilerOptions": { "module": "commonjs", "target": "es5", "skipLibCheck": true, "declaration": false, "noImplicitAny": false, "noImplicitUseStrict": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "pretty": true, "noEmitHelpers": true, "noEmitOnError": true, "lib": [ "es2016" ] }, "exclude": [ "node_modules", "platforms", "**/*.aot.ts" ] }

references (outside of app folder)

`

///
declare type Comment = any;
declare type CloseEvent = any;
declare type Document = any;
declare type DocumentFragment = any;
declare type Element = any;
declare type History = any;
declare type HTMLAnchorElement = any;
declare type HTMLCollection = any;
declare type HTMLDocument = any;
declare type HTMLElement = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Location = any;
declare type MessageEvent = any;
declare type MouseEvent = any;
declare type Node = any;
declare type NodeList = any;
declare type Text = any;
declare type WebSocket = any;`

references (inside app folder)

/// <reference path="../node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" /> Needed for autocompletion and compilation.

tsconfig (inside app folder)

{ "compilerOptions": { "module": "commonjs", "target": "es5", "sourceMap": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmitHelpers": true, "noEmitOnError": true }, "exclude": [ "node_modules", "platforms" ] }

this also may help.
tsconfig.aot outside of app folder

`{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"types": [],
"baseUrl": ".",
"paths": {
"ui/": ["node_modules/tns-core-modules/ui/"],
"platform": ["node_modules/tns-core-modules/platform"],
"image-source": ["node_modules/tns-core-modules/image-source"],
"xml": ["node_modules/tns-core-modules/xml"],
"xhr": ["node_modules/tns-core-modules/xhr"],
"text": ["node_modules/tns-core-modules/text"],
"data": ["node_modules/tns-core-modules/data"],
"fetch": ["node_modules/tns-core-modules/fetch"],
"trace": ["node_modules/tns-core-modules/trace"],
"fps-meter": ["node_modules/tns-core-modules/fps-meter"],
"color": ["node_modules/tns-core-modules/color"],
"application-settings": ["node_modules/tns-core-modules/application-settings"],
"http": ["node_modules/tns-core-modules/http"],
"camera": ["node_modules/tns-core-modules/camera"],
"console": ["node_modules/tns-core-modules/console"],
"timer": ["node_modules/tns-core-modules/timer"],
"utils": ["node_modules/tns-core-modules/utils"],
"location": ["node_modules/tns-core-modules/location"],
"file-system": ["node_modules/tns-core-modules/file-system"],
"application": ["node_modules/tns-core-modules/application"],
"image-asset": ["node_modules/tns-core-modules/image-asset"],
"connectivity": ["node_modules/tns-core-modules/connectivity"],
"globals": ["node_modules/tns-core-modules/globals"]

}

},
"exclude": [
"node_modules",
"platforms"
],
"angularCompilerOptions": {
"skipMetadataEmit": true,
"genDir": "./"
}
}
`

I hope this helps!

(seems github doesn't like these files much, sorry for the bad formatting but I cant seem to fix it. it is literally removing code for no reason )

SamuelReeder commented Mar 3, 2017

@alixandru of course. Sorry for the delay

tnsconfig

{ "compilerOptions": { "module": "commonjs", "target": "es5", "skipLibCheck": true, "declaration": false, "noImplicitAny": false, "noImplicitUseStrict": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "pretty": true, "noEmitHelpers": true, "noEmitOnError": true, "lib": [ "es2016" ] }, "exclude": [ "node_modules", "platforms", "**/*.aot.ts" ] }

references (outside of app folder)

`

///
declare type Comment = any;
declare type CloseEvent = any;
declare type Document = any;
declare type DocumentFragment = any;
declare type Element = any;
declare type History = any;
declare type HTMLAnchorElement = any;
declare type HTMLCollection = any;
declare type HTMLDocument = any;
declare type HTMLElement = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Location = any;
declare type MessageEvent = any;
declare type MouseEvent = any;
declare type Node = any;
declare type NodeList = any;
declare type Text = any;
declare type WebSocket = any;`

references (inside app folder)

/// <reference path="../node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" /> Needed for autocompletion and compilation.

tsconfig (inside app folder)

{ "compilerOptions": { "module": "commonjs", "target": "es5", "sourceMap": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmitHelpers": true, "noEmitOnError": true }, "exclude": [ "node_modules", "platforms" ] }

this also may help.
tsconfig.aot outside of app folder

`{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"types": [],
"baseUrl": ".",
"paths": {
"ui/": ["node_modules/tns-core-modules/ui/"],
"platform": ["node_modules/tns-core-modules/platform"],
"image-source": ["node_modules/tns-core-modules/image-source"],
"xml": ["node_modules/tns-core-modules/xml"],
"xhr": ["node_modules/tns-core-modules/xhr"],
"text": ["node_modules/tns-core-modules/text"],
"data": ["node_modules/tns-core-modules/data"],
"fetch": ["node_modules/tns-core-modules/fetch"],
"trace": ["node_modules/tns-core-modules/trace"],
"fps-meter": ["node_modules/tns-core-modules/fps-meter"],
"color": ["node_modules/tns-core-modules/color"],
"application-settings": ["node_modules/tns-core-modules/application-settings"],
"http": ["node_modules/tns-core-modules/http"],
"camera": ["node_modules/tns-core-modules/camera"],
"console": ["node_modules/tns-core-modules/console"],
"timer": ["node_modules/tns-core-modules/timer"],
"utils": ["node_modules/tns-core-modules/utils"],
"location": ["node_modules/tns-core-modules/location"],
"file-system": ["node_modules/tns-core-modules/file-system"],
"application": ["node_modules/tns-core-modules/application"],
"image-asset": ["node_modules/tns-core-modules/image-asset"],
"connectivity": ["node_modules/tns-core-modules/connectivity"],
"globals": ["node_modules/tns-core-modules/globals"]

}

},
"exclude": [
"node_modules",
"platforms"
],
"angularCompilerOptions": {
"skipMetadataEmit": true,
"genDir": "./"
}
}
`

I hope this helps!

(seems github doesn't like these files much, sorry for the bad formatting but I cant seem to fix it. it is literally removing code for no reason )

@elinswilberg

This comment has been minimized.

Show comment
Hide comment
@elinswilberg

elinswilberg Mar 7, 2017

This worked for me trying (using nativescript-angular 2.5.2):

Add this line to the file accessing the native API:
/// <reference path="../../node_modules/tns-platform-declarations/ios/ios.d.ts" /> Needed for autocompletion and compilation.

Ex.:

/// <reference path="../../node_modules/tns-platform-declarations/ios/ios.d.ts" /> Needed for autocompletion and compilation.

class UIImagePickerControllerDelegateImplementation extends NSObject implements UIImagePickerControllerDelegate {
  static ObjCProtocols = [UIImagePickerControllerDelegate];

  static new(): UIImagePickerControllerDelegateImplementation {
    return <UIImagePickerControllerDelegateImplementation>super.new();
  }
}

My ts.config.json looks like this:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "noImplicitUseStrict": true,
        "noEmitHelpers": true,
        "declaration": false,
        "removeComments": false,
        "noEmitOnError": false,
        "noImplicitAny": false,
        "noLib": false
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

My references.d.ts still looks like this:
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.

I am now able to build the app and everything works as expected.

elinswilberg commented Mar 7, 2017

This worked for me trying (using nativescript-angular 2.5.2):

Add this line to the file accessing the native API:
/// <reference path="../../node_modules/tns-platform-declarations/ios/ios.d.ts" /> Needed for autocompletion and compilation.

Ex.:

/// <reference path="../../node_modules/tns-platform-declarations/ios/ios.d.ts" /> Needed for autocompletion and compilation.

class UIImagePickerControllerDelegateImplementation extends NSObject implements UIImagePickerControllerDelegate {
  static ObjCProtocols = [UIImagePickerControllerDelegate];

  static new(): UIImagePickerControllerDelegateImplementation {
    return <UIImagePickerControllerDelegateImplementation>super.new();
  }
}

My ts.config.json looks like this:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "noImplicitUseStrict": true,
        "noEmitHelpers": true,
        "declaration": false,
        "removeComments": false,
        "noEmitOnError": false,
        "noImplicitAny": false,
        "noLib": false
    },
    "exclude": [
        "node_modules",
        "platforms"
    ]
}

My references.d.ts still looks like this:
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.

I am now able to build the app and everything works as expected.

@alixandru

This comment has been minimized.

Show comment
Hide comment
@alixandru

alixandru Mar 10, 2017

No luck. I tried both suggestions and neither worked. I gave up and went on using declares (and living without VSCode's code completion). Thanks for your time anyway.

alixandru commented Mar 10, 2017

No luck. I tried both suggestions and neither worked. I gave up and went on using declares (and living without VSCode's code completion). Thanks for your time anyway.

@vance

This comment has been minimized.

Show comment
Hide comment
@vance

vance Mar 24, 2017

@elinswilberg Do you mean tns-platform-declarations version 2.5.2? What version of tns-=core-modules, 2.5.2 as well? nativescript-angular is still version 1.4

vance commented Mar 24, 2017

@elinswilberg Do you mean tns-platform-declarations version 2.5.2? What version of tns-=core-modules, 2.5.2 as well? nativescript-angular is still version 1.4

@sarvagayatri

This comment has been minimized.

Show comment
Hide comment
@sarvagayatri

sarvagayatri Apr 3, 2017

3 declare class Request {
~~~~~~~
node_modules/tns-core-modules/declarations.d.ts(3,15): error TS2300: Duplicate identifier 'Request'.
36 declare class Headers {
~~~~~~~
node_modules/tns-core-modules/declarations.d.ts(36,15): error TS2300: Duplicateidentifier 'Headers'.
56 declare class Response extends Body {
~~~~~~~~

node_modules/tns-core-modules/declarations.d.ts(56,15): error TS2300: Duplicateidentifier 'Response'.

78 declare type BodyInit = Blob|FormData|string;
~~~~~~~~

node_modules/tns-core-modules/declarations.d.ts(78,14): error TS2300: Duplicateidentifier 'BodyInit'.

79 declare type RequestInfo = Request|string;
~~~~~~~~~~~

node_modules/tns-core-modules/declarations.d.ts(79,14): error TS2300: Duplicateidentifier 'RequestInfo'.

5313 headers?: any;
~~~~~~~
node_modules/typescript/lib/lib.d.ts(5313,5): error TS2403: Subsequent variabledeclarations must have the same type. Variable 'headers' must be of

type 'string[] | Headers | { [index: string]: string; }', but here has type 'any'.
5314 body?: any;
~~~~
node_modules/typescript/lib/lib.d.ts(5314,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of

type 'BodyInit', but here has type 'any'.
5317 mode?: string;
~~~~
node_modules/typescript/lib/lib.d.ts(5317,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'mode' must be of

type 'RequestMode', but here has type 'string'.
5318 credentials?: string;
~~~~~~~~~~~
node_modules/typescript/lib/lib.d.ts(5318,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'credentials' must

be of type 'RequestCredentials', but here has type 'string'.
5319 cache?: string;
~~~~~
node_modules/typescript/lib/lib.d.ts(5319,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'cache' must be of

type 'RequestCache', but here has type 'string'.
5327 status?: number;
~~~~~~
node_modules/typescript/lib/lib.d.ts(5327,5): error TS2687: All declarations of 'status' must have identical modifiers.
5328 statusText?: string;
~~~~~~~~~~
node_modules/typescript/lib/lib.d.ts(5328,5): error TS2687: All declarations of 'statusText' must have identical modifiers.
5329 headers?: any;
~~~~~~~

node_modules/typescript/lib/lib.d.ts(5329,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'headers' must be of

type 'HeaderInit', but here has type 'any'.

5329 headers?: any;
~~~~~~~
node_modules/typescript/lib/lib.d.ts(5329,5): error TS2687: All declarations of 'headers' must have identical modifiers.

11168 interface Headers {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(11168,11): error TS2300: Duplicate identifier 'Headers'.

11177 declare var Headers: {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(11177,13): error TS2300: Duplicate identifier 'Headers'.

13566 interface Request extends Object, Body {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(13566,11): error TS2300: Duplicate identifier 'Request'.

13583 declare var Request: {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(13583,13): error TS2300: Duplicate identifier 'Request'.

13588 interface Response extends Object, Body {
~~~~~~~~

node_modules/typescript/lib/lib.d.ts(13588,11): error TS2300: Duplicate identifier 'Response'.

13599 declare var Response: {
~~~~~~~~
node_modules/typescript/lib/lib.d.ts(13599,13): error TS2300: Duplicate identifier 'Response'.

17714 readonly bodyUsed: boolean;
~~~~~~~~
node_modules/typescript/lib/lib.d.ts(17714,14): error TS2687: All declarations of 'bodyUsed' must have identical modifiers.

19121 type BodyInit = any;
~~~~~~~~
node_modules/typescript/lib/lib.d.ts(19121,6): error TS2300: Duplicate identifier 'BodyInit'.

19152 type RequestInfo = Request | string;
~~~~~~~~~~~
node_modules/typescript/lib/lib.d.ts(19152,6): error TS2300: Duplicate identifier 'RequestInfo'.

sarvagayatri commented Apr 3, 2017

3 declare class Request {
~~~~~~~
node_modules/tns-core-modules/declarations.d.ts(3,15): error TS2300: Duplicate identifier 'Request'.
36 declare class Headers {
~~~~~~~
node_modules/tns-core-modules/declarations.d.ts(36,15): error TS2300: Duplicateidentifier 'Headers'.
56 declare class Response extends Body {
~~~~~~~~

node_modules/tns-core-modules/declarations.d.ts(56,15): error TS2300: Duplicateidentifier 'Response'.

78 declare type BodyInit = Blob|FormData|string;
~~~~~~~~

node_modules/tns-core-modules/declarations.d.ts(78,14): error TS2300: Duplicateidentifier 'BodyInit'.

79 declare type RequestInfo = Request|string;
~~~~~~~~~~~

node_modules/tns-core-modules/declarations.d.ts(79,14): error TS2300: Duplicateidentifier 'RequestInfo'.

5313 headers?: any;
~~~~~~~
node_modules/typescript/lib/lib.d.ts(5313,5): error TS2403: Subsequent variabledeclarations must have the same type. Variable 'headers' must be of

type 'string[] | Headers | { [index: string]: string; }', but here has type 'any'.
5314 body?: any;
~~~~
node_modules/typescript/lib/lib.d.ts(5314,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of

type 'BodyInit', but here has type 'any'.
5317 mode?: string;
~~~~
node_modules/typescript/lib/lib.d.ts(5317,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'mode' must be of

type 'RequestMode', but here has type 'string'.
5318 credentials?: string;
~~~~~~~~~~~
node_modules/typescript/lib/lib.d.ts(5318,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'credentials' must

be of type 'RequestCredentials', but here has type 'string'.
5319 cache?: string;
~~~~~
node_modules/typescript/lib/lib.d.ts(5319,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'cache' must be of

type 'RequestCache', but here has type 'string'.
5327 status?: number;
~~~~~~
node_modules/typescript/lib/lib.d.ts(5327,5): error TS2687: All declarations of 'status' must have identical modifiers.
5328 statusText?: string;
~~~~~~~~~~
node_modules/typescript/lib/lib.d.ts(5328,5): error TS2687: All declarations of 'statusText' must have identical modifiers.
5329 headers?: any;
~~~~~~~

node_modules/typescript/lib/lib.d.ts(5329,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'headers' must be of

type 'HeaderInit', but here has type 'any'.

5329 headers?: any;
~~~~~~~
node_modules/typescript/lib/lib.d.ts(5329,5): error TS2687: All declarations of 'headers' must have identical modifiers.

11168 interface Headers {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(11168,11): error TS2300: Duplicate identifier 'Headers'.

11177 declare var Headers: {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(11177,13): error TS2300: Duplicate identifier 'Headers'.

13566 interface Request extends Object, Body {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(13566,11): error TS2300: Duplicate identifier 'Request'.

13583 declare var Request: {
~~~~~~~
node_modules/typescript/lib/lib.d.ts(13583,13): error TS2300: Duplicate identifier 'Request'.

13588 interface Response extends Object, Body {
~~~~~~~~

node_modules/typescript/lib/lib.d.ts(13588,11): error TS2300: Duplicate identifier 'Response'.

13599 declare var Response: {
~~~~~~~~
node_modules/typescript/lib/lib.d.ts(13599,13): error TS2300: Duplicate identifier 'Response'.

17714 readonly bodyUsed: boolean;
~~~~~~~~
node_modules/typescript/lib/lib.d.ts(17714,14): error TS2687: All declarations of 'bodyUsed' must have identical modifiers.

19121 type BodyInit = any;
~~~~~~~~
node_modules/typescript/lib/lib.d.ts(19121,6): error TS2300: Duplicate identifier 'BodyInit'.

19152 type RequestInfo = Request | string;
~~~~~~~~~~~
node_modules/typescript/lib/lib.d.ts(19152,6): error TS2300: Duplicate identifier 'RequestInfo'.

@SvetoslavTsenov SvetoslavTsenov self-assigned this Apr 27, 2017

@PanayotCankov

This comment has been minimized.

Show comment
Hide comment
@PanayotCankov

PanayotCankov Apr 28, 2017

Member

There were few conflicting classes such as UIEvent that we renamed to _UIEvent by hand (this means there API is now incorrect in the cases of iOS classes prefixed by _) but the tns-platform-declarations will build correctly event with dom definitions included. (e.g. UIEvent from dom and from UIKit won't clash).

https://github.com/NativeScript/NativeScript/blob/master/tns-platform-declarations/ios/objc-i386/objc!UIKit.d.ts#L4954

Now you can install the declarations like npm i tns-platform-declarations@3.0.0-rc.2 --save-dev in {N} app and the app will build correctly without requiring changes in the tsconfig lib.

Member

PanayotCankov commented Apr 28, 2017

There were few conflicting classes such as UIEvent that we renamed to _UIEvent by hand (this means there API is now incorrect in the cases of iOS classes prefixed by _) but the tns-platform-declarations will build correctly event with dom definitions included. (e.g. UIEvent from dom and from UIKit won't clash).

https://github.com/NativeScript/NativeScript/blob/master/tns-platform-declarations/ios/objc-i386/objc!UIKit.d.ts#L4954

Now you can install the declarations like npm i tns-platform-declarations@3.0.0-rc.2 --save-dev in {N} app and the app will build correctly without requiring changes in the tsconfig lib.

@MehdiAroui

This comment has been minimized.

Show comment
Hide comment
@MehdiAroui

MehdiAroui Sep 9, 2017

still have the same problem

MehdiAroui commented Sep 9, 2017

still have the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment