sp-dev-docs
sp-dev-docs copied to clipboard
There is problems with this example code. It wil render an error - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type
Im new to this topicks and when the tutor contains coding errors, it makes me struggle hard to understand where the problems are and how to solve them. Its important to make sure the code in the tutors actually works. After a lot of googelin, I found this article: https://bobbyhadz.com/blog/typescript-element-implicitly-has-any-type-expression wich eventually led to the following solution:
In the ListItemsWebParts.ts, class ListItemsWebPart, method LoadItems
Change resolve(items[wp.properties.listName]); to resolve(items[wp.properties.listName as keyof typeof items]);
And now it finally works...
I cant say for sure that this was a valid solution or not, but at least it made my day :D
Regards ....
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 1c1d71f2-3508-56e2-6ea7-461591498d19
- Version Independent ID: 0546c161-74c4-fb37-ce89-f7cf0e49cf91
- Content: Build custom controls for the property pane
- Content Source: docs/spfx/web-parts/guidance/build-custom-property-pane-controls.md
- Product: sharepoint
- Technology: sharepoint-framework
- GitHub Login: @VesaJuvonen
- Microsoft Alias: vesaj
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.