- Notifications
You must be signed in to change notification settings - Fork 28
Typings fix #29
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
Typings fix #29
Conversation
| Hey @Kraviecc, Thanks for using this library. Kind Regards, |
| Thanks, that worked! |
| Hello! What I am doing wrong? If I use |
| Hi @FixRM, The WebApiClient is exported as default export, so you have to import it as default import as well: If that does not work: Kind Regards, |
| Hello @DigitalFlow. In this case I have error:
|
| I'm not sure why but in this case compiler see only one property called "default" for imported WebApiClient object and this property is not available in run time as well |
| @FixRM: |
| @DigitalFlow, same problem: TypeError: Cannot read property 'Retrieve' of undefined |
| @FixRM Can you please post the version you installed and your tsconfig.json? |
| Sure, I took latest from NPM:
Do you have working example written in TypeScript? |
| Hi @FixRM, a project containing only this this and this compiles fine at my side. TSC version is 2.9.2, WebApiClient is also v3.6.16. |
| Thanks, I will try later. But will it work for modern versions of TypeScript? I use 3.6.4 |
| Yes it will 👍 |
| @DigitalFlow, how do you execute it? It compiles well for me too, but as I said, I got errors at runtime. Can you please check my sample repo? I try to run it from jest unit test (I know, I know I need to fake XHR) but it failed to run much earlier due to broken reference. I'm a little bit new here, so may be jest/tsc/node/etc is not configured properly - I don't know. After all I want to get browser compatible thing but it is not es6 for sure. |
| @FixRM: |
| @DigitalFlow, it doesn't help. It compiles well, but I still have
at runtime when running jest unit test |
| I put suggested change in the repo. Can you please try to run test command? |
Hi @DigitalFlow,
I've found it difficult to make it work with typescript. When I've tried to import it with line:
import { WebApiClient } from "xrm-webapi-client"it shows error that..../WebApiClient has no exported member 'WebApiClient'. I've fixed it by changing typings as in this pull request. Please take a look at this.