import MockHttpClient from './MockHttpClient'; given issues TS2306 file is not module.
Any advise?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 71e8ee66-fe7c-a46e-eeec-fb199962042c
- Version Independent ID: f78aef17-5aa2-8807-73d4-509faecbd153
- Content: Connect your client-side web part to SharePoint (Hello World part 2)
- Content Source: docs/spfx/web-parts/get-started/connect-to-sharepoint.md
- Product: sharepoint
- GitHub Login: @spdevdocs
- Microsoft Alias: spdevdocs
This most likely indicates a typo in the file or placing the file in a wrong location. Would recommend checking example from https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/tutorials/tutorial-getting-started for seeing what's the difference. As we cannot reproduce the issue, closing this one.
Vesa - I started afresh with a new laptop and new instance of the helloworld demo - I was following along with the documentation for the first time in over a year. I have the exact same problem as gzhou2018 listed above, which probably means it is a thing, but no idea why. And this is one of those stupid things you really hate as a developer, cos it is now working and I don't know why.
For over an hour I was getting this every time I saved the file. [15:25:00] Error - typescript - src\webparts\helloWorld\HelloWorldWebPart.ts(14,28): error TS2306: File 'C:/REpo/SPFx/helloworld-webpart/src/webparts/helloWorld/MockHttpClient.ts' is not a module. I deleted and recreated the MockHttpClient file with no success.
You're not going to believe this.........but......I went to the github site you listed above and found the MockHttpClient.js file, copied and pasted it into my code, the only difference I could see was code indentation. Magically it worked.......so thanks for the link, i think :)
I am now really annoyed that I cannot repeat it - no issues at all (facepalm)
Something screwy is there
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