1

I've been fiddling around with this issue for some hours.

Here's my dependencies:

"dependencies": {
    "@microsoft/sp-core-library": "~1.1.0",
    "@microsoft/sp-http": "^0.1.2",
    "@microsoft/sp-webpart-base": "~1.1.1",
    "@types/react": "0.14.46",
    "@types/react-addons-shallow-compare": "0.14.17",
    "@types/react-addons-test-utils": "0.14.15",
    "@types/react-addons-update": "0.14.14",
    "@types/react-dom": "0.14.18",
    "@types/webpack-env": ">=1.12.1 <1.14.0",
    "react": "15.4.2",
    "react-dom": "15.4.2"
}

Here's my import:

import {SPHttpClient, SPHttpClientConfiguration, SPHttpClientResponse,
ISPHttpClientConfiguration} from '@microsoft/sp-http'; 

Here's the function:

    private loadFieldsAPI(): Promise<object[]> {
    let clienturl: string = this.context.pageContext.web.absoluteUrl + "/_api/web/lists(guid'" + this.context.pageContext.list.id + "')/fields?$select=Id,Title'";


    return this.context.spHttpClient.get(clienturl, SPHttpClient.configurations.v1)
        .then((response: SPHttpClientResponse) => {
            return response.json();
        });
    }

So far I've tried

  • Removing my node_modules folder and doing npm i.
  • Removing and reinstalling @microsoft/sp-http to several different versions
  • Removing the sp-http reference from my package.json file.

The complete error is

error TS2345: Argument of type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'.

Any suggestion as to what i can try next is very appreciated!

  • is this sharepoint online or 2016 on prem ? – Gautam Sheth Oct 25 '17 at 6:41
  • This is sharepoint online – swearhouse Oct 25 '17 at 6:51
  • Refer this link - github.com/SharePoint/sp-dev-docs/issues/911 – Rohit Waghela Oct 25 '17 at 7:10
  • As per the link - I am still receiving the error after trying to remove the reference from package.json, and copying a new installation of the node_modules folder... – swearhouse Oct 25 '17 at 7:56
1

You're using an older version of the @microsoft/sp-http package comparing to other @microsoft packages in your project. I'd suggest you create a new project and compare the list of dependencies with the list in your project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.