question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NS_HTTP_PROVIDERS angular rc4 with nativescript-angular@0.3.1 still problem

See original GitHub issue

If you just import NS_HTTP_PROVIDERS and set on your bootstrap, you won’t pass through the Typescript compiler and will get this error:

Found peer TypeScript 1.8.10
node_modules/nativescript-angular/http/ns-http.d.ts(8,22): error TS2415: Class 'NSHttp' incorrectly extends base class 'Http'.
  Types of property 'get' are incompatible.
    Type '(url: string, options?: RequestOptionsArgs) => Observable<any>' is not assignable to type '(url: string, options?: RequestOptionsArgs) => Observable<Response>'.
      Type 'Observable<any>' is not assignable to type 'Observable<Response>'.
        Property 'source' is protected but type 'Observable<T>' is not a class derived from 'Observable<T>'.

To check this bug, follow these steps:

tns create myapp --template tns-template-hello-world-ng

Then, import NS_HTTP_PROVIDERS:

import {NS_HTTP_PROVIDERS} from 'nativescript-angular/http';
nativeScriptBootstrap(AppComponent, [NS_HTTP_PROVIDERS])

So try add a platform and run:

tns platform add ios
tns run ios --emulator

Temporary solution

If you’ve set compilerOptions to false on tsconfig.json, the tsc will ignore it, and your app will run great. (Even if you use Http service).

I believe something related to the declaration on node_modules/nativescript-angular/http/ns-http.d.ts that doesn’t follow with the angular rc-4.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:31 (20 by maintainers)

github_iconTop GitHub Comments

3reactions
NathanaelAcommented, Dec 7, 2016

Just one note for anyone in the future who might run into this (again). Occasionally npm will also install RXJS into a sub-folder of one of the modules; if you continue to get this error even after you have deleted your node_modules folder. Double check each of the modules to see if they have any sub “node_modules” folders themselves; and if they do; delete any extra the “rxjs” that ends up in as a sub-folder version. The beta5 that got installed by one of them; conflicted with the beta12 that was needed by everything else, and caused the primary error in this issue.

1reaction
hdeshevcommented, Sep 21, 2016

Closing since the problem should be resolved with 2.0.0 final and the NativeScriptHttpModule that sets up providers for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrapping angular RC4 with SystemJS throws Uncaught ...
The error focuses on the first angle bracket of the html file. As if systemJS tries to run the index.html as the config...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found