sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Version 1.5.0-plusbeta Argument of type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'

Open sid1260 opened this issue 8 years ago • 6 comments

Category

  • [ ] Question
  • [ ] Typo
  • [X] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

I wanted to use the dynamicDataSourceManager ( based on the example https://docs.microsoft.com/en-us/sharepoint/dev/spfx/dynamic-data ). This required a version 1.5.0-plusbeta. I ended up upgrading to the beta version, but I am facing the following issue Argument of type 'SPHttpClientConfiguration' is not assignable to parameter of type 'SPHttpClientConfiguration'

I tried to delete the node module and run "npm i". But facing the same error.

Observed Behavior

Steps to Reproduce

I ran the following npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected] npm i @microsoft/[email protected]

Error in the line spHttpClient.post let options: ISPHttpClientOptions = { headers: { 'odata-version': '3.0' }, body: JSON.stringify(data) }; const spConfig: ISPHttpClientConfiguration = { defaultODataVersion: ODataVersion.v3 }; const clientConfigODataV3: SPHttpClientConfiguration = SPHttpClient.configurations.v1.overrideWith(spConfig);

    return this._context.spHttpClient.post(endpoint, clientConfigODataV3, options)

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

My package.config is the following: { "name": "digital-workplace", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "@microsoft/decorators": "^1.5.0-plusbeta", "@microsoft/sp-application-base": "^1.5.0-plusbeta", "@microsoft/sp-core-library": "^1.5.0-plusbeta", "@microsoft/sp-dialog": "^1.5.0-plusbeta", "@microsoft/sp-dynamic-data": "^1.5.0-plusbeta", "@microsoft/sp-http": "^1.5.0-plusbeta", "@microsoft/sp-lodash-subset": "^1.5.0-plusbeta", "@microsoft/sp-office-ui-fabric-core": "^1.5.0-plusbeta", "@microsoft/sp-webpart-base": "^1.5.0-plusbeta", "@pnp/common": "^1.1.0", "@pnp/logging": "^1.1.0", "@pnp/odata": "^1.1.0", "@pnp/sp": "^1.1.0", "@types/react": "15.6.6", "@types/react-dom": "15.5.6", "@types/webpack-env": ">=1.12.1 <1.14.0", "gulp-spsync-creds": "^2.3.8", "jquery": "^3.3.1", "npm-check-updates": "^2.14.2", "react": "15.6.2", "react-dom": "15.6.2", "react-flip-move": "^3.0.2", "react-iframe": "^1.1.0", "run-sequence": "^2.2.1", "sp-client-custom-fields": "^1.3.7" }, "devDependencies": { "@microsoft/sp-build-web": "^1.5.0-plusbeta", "@microsoft/sp-module-interfaces": "^1.5.0-plusbeta", "@microsoft/sp-module-loader": "^0.5.1", "@microsoft/sp-webpart-workbench": "^1.5.0-plusbeta", "@types/chai": ">=3.4.34 <3.6.0", "@types/mocha": ">=2.2.33 <2.6.0", "ajv": "~5.2.2", "css-loader": "^0.28.11", "gulp": "~3.9.1", "style-loader": "^0.21.0" } }

sid1260 avatar Jun 07 '18 08:06 sid1260

Can you list your imports too?

guillaume-kizilian avatar Jun 07 '18 08:06 guillaume-kizilian

Sure..

import { AadHttpClient, HttpClientResponse, ISPHttpClientConfiguration, ODataVersion, SPHttpClientConfiguration, ISPHttpClientOptions, SPHttpClientResponse, SPHttpClient } from '@microsoft/sp-http'; import { Text } from '@microsoft/sp-core-library'; import { WebPartContext } from '@microsoft/sp-webpart-base'; import { sp, Web, Item, ListEnsureResult, SPConfiguration } from "@pnp/sp";

sid1260 avatar Jun 07 '18 09:06 sid1260

In the past what I've noticed with npm is that you need to delete the package lock file when you delete node_modules. The error you see normally means that there are multiple copies of a package. Alternately, I've found that using pnpm gets rid of the mistakes that npm typically generates.

patmill avatar Jun 08 '18 16:06 patmill

I had tried the the deletion of the package-lock.json file , but still facing this issue. I ended up using Redux to connect two webparts. Probably will wait for a stabler release to implement the event notification feature.

I have not tried pnpm. But thanks for the pointer.

sid1260 avatar Jun 12 '18 06:06 sid1260

Had the same issue, installed Yarn solved it.

alexandervonmalachowski avatar Jun 16 '18 03:06 alexandervonmalachowski

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 27 '20 12:01 msft-github-bot