'type' does not exist in type 'SymbolProperties'
See original GitHub issueI am reporting an issue with
- TypeScript definitions
- another resource in this repository
I’m getting a type error with Graphic. I’ve cloned this repo and added Graphic to the app.component.ts. When I add the following code I get a compilation error from Visual Studio Code “Type ‘{ type: string; color: number[]; outline: null; }’ is not assignable to type ‘SymbolProperties’. Object literal may only specify known properties, and ‘type’ does not exist in type ‘SymbolProperties’.ts(2322)”
const extentGraphic = new Graphic({ geometry: null, symbol: { type: 'simple-fill', color: [0, 0, 0, 0.5], outline: null } });
The symbol property on Graphic should autocast to Symbol. Type is a valid property on symbol. https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-Symbol.html#properties-summary Is there an error in the 4.18 api or is there some sort of typescript error?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
We recently worked on support for this type of auto-casting in the typings, it should become available in the 4.19 (March) release.
Hi @overcash597 that is correct, and thanks for everyone’s patience on this. This issue is related to functionality that finally made it into TypeScript 4.3, and it just became a release candidate on May 12. Since we still need to verify this functionality and wait for TypeScript 4.3 to become final, we don’t expect this to make the 4.20 release which is tentatively planned for the end of June.
In the meantime, in order to get your build to work you will need initialize
new SimpleFillSymbol()
,new SimpleLineSymbol()
andnew Color()
. You’ll have to extract all autocasted Classes and initialize them separately.The 4.20 doc is also being updated to reflect this issue.