App won't build after updating to 2.5.1 :-(


#1

Hi,

After updating to version 2.5.1 I get multiple TypeScript (2.2.1) errors.
Any idea how to solve this problem?

tns run ios
Executing before-prepare hook from /Users/rowdy/Github/Nationale-Nederlanden/JIL/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /Users/rowdy/Github/Nationale-Nederlanden/JIL/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.2.1
node_modules/tns-core-modules/declarations.d.ts(3,15): error TS2300: Duplicate identifier ‘Request’.

node_modules/tns-core-modules/declarations.d.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable ‘headers’ must be of type ‘any’, but here has type ‘string[] | Headers | { [index: string]: string; }’.

node_modules/tns-core-modules/declarations.d.ts(19,5): error TS2403: Subsequent variable declarations must have the same type. Variable ‘mode’ must be of type ‘string’, but here has type ‘RequestMode’.
node_modules/tns-core-modules/declarations.d.ts(20,5): error TS2403: Subsequent variable declarations must have the same type. Variable ‘credentials’ must be of type ‘string’, but here has type ‘RequestCredentials’.

node_modules/tns-core-modules/declarations.d.ts(21,5): error TS2403: Subsequent variable declarations must have the same type. Variable ‘cache’ must be of type ‘string’, but here has type ‘RequestCache’.

node_modules/tns-core-modules/declarations.d.ts(36,15): error TS2300: Duplicate identifier ‘Headers’.
node_modules/tns-core-modules/declarations.d.ts(46,5): error TS2687: All declarations of ‘bodyUsed’ must have identical modifiers.

node_modules/tns-core-modules/declarations.d.ts(56,15): error TS2300: Duplicate identifier ‘Response’.
node_modules/tns-core-modules/declarations.d.ts(72,5): error TS2687: All declarations of ‘status’ must have identical modifiers.

node_modules/tns-core-modules/declarations.d.ts(73,5): error TS2687: All declarations of ‘statusText’ must have identical modifiers.
node_modules/tns-core-modules/declarations.d.ts(74,5): error TS2403: Subsequent variable declarations must have the same type. Variable ‘headers’ must be of type ‘any’, but here has type ‘HeaderInit’.
node_modules/tns-core-modules/declarations.d.ts(74,5): error TS2687: All declarations of ‘headers’ must have identical modifiers.
node_modules/tns-core-modules/declarations.d.ts(78,14): error TS2300: Duplicate identifier ‘BodyInit’.

node_modules/tns-core-modules/declarations.d.ts(79,14): error TS2300: Duplicate identifier ‘RequestInfo’.

node_modules/typescript/lib/lib.d.ts(5327,5): error TS2687: All declarations of ‘status’ must have identical modifiers.

node_modules/typescript/lib/lib.d.ts(5328,5): error TS2687: All declarations of ‘statusText’ must have identical modifiers.
node_modules/typescript/lib/lib.d.ts(5329,5): error TS2687: All declarations of ‘headers’ must have identical modifiers.
node_modules/typescript/lib/lib.d.ts(11168,11): error TS2300: Duplicate identifier ‘Headers’.
node_modules/typescript/lib/lib.d.ts(11177,13): error TS2300: Duplicate identifier ‘Headers’.
node_modules/typescript/lib/lib.d.ts(13566,11): error TS2300: Duplicate identifier ‘Request’.

node_modules/typescript/lib/lib.d.ts(13583,13): error TS2300: Duplicate identifier ‘Request’.
node_modules/typescript/lib/lib.d.ts(13588,11): error TS2300: Duplicate identifier ‘Response’.
node_modules/typescript/lib/lib.d.ts(13599,13): error TS2300: Duplicate identifier ‘Response’.

node_modules/typescript/lib/lib.d.ts(17714,14): error TS2687: All declarations of ‘bodyUsed’ must have identical modifiers.
node_modules/typescript/lib/lib.d.ts(19121,6): error TS2300: Duplicate identifier ‘BodyInit’.

node_modules/typescript/lib/lib.d.ts(19152,6): error TS2300: Duplicate identifier ‘RequestInfo’.

TypeScript compiler failed with exit code 1

My package.json:
{
“description”: “Jouw Inkomen Later”,
“license”: “SEE LICENSE IN “,
“readme”: “NativeScript Application”,
“repository”: “”,
“nativescript”: {
“id”: “org.nativescript.JIL”,
“tns-ios”: {
“version”: “2.5.0”
}
},
“dependencies”: {
@angular/common”: “2.2.1”,
"@angular/compiler": “2.2.1”,
"@angular/core": “2.2.1”,
"@angular/forms": “2.2.1”,
"@angular/http": “2.2.1”,
"@angular/platform-browser": “2.2.1”,
"@angular/platform-browser-dynamic": “2.2.1”,
"@angular/router": “3.2.1”,
“accounting”: “^0.4.1”,
“base-64”: “^0.1.0”,
“crypto-js”: “^3.1.9-1”,
“nativescript-angular”: “1.2.0”,
“nativescript-appversion”: “^1.3.2”,
“nativescript-couchbase”: “^1.0.16”,
“nativescript-email”: “^1.4.0”,
“nativescript-ngx-fonticon”: “^2.0.0”,
“nativescript-telerik-ui”: “^1.6.0”,
“nativescript-theme-core”: “^0.2.1”,
“ng2-translate”: “^5.0.0”,
“reflect-metadata”: “~0.1.8”,
“rxjs”: “5.0.0-beta.12”,
“tns-core-modules”: “^2.5.1”
},
“devDependencies”: {
“babel-traverse”: “6.19.0”,
“babel-types”: “6.19.0”,
“babylon”: “6.14.1”,
“lazy”: “1.0.11”,
“nativescript-dev-android-snapshot”: “^0..”,
“nativescript-dev-typescript”: “^0.3.2”,
“typescript”: “^2.0.10”,
“zone.js”: “~0.6.21”
}
}


#2

I got a (temporary) solution handed via Twitter (@iguissouma):

can you try to configure your tsconfig.json with the folowing options“noEmitHelpers”: false, and “noEmitOnError”: false.


#3

This is problem with the latest TypeScript. Please do the following:

npm remove typescript --save-dev && npm install typescript@2.1 --save-dev


#4

I experienced the same errors when trying to use TypeScript versions >=2.2.

According to the related issue on the nativescript-dev-typescript Github repository, the fixes will come with the NativeScript 3.0 release.