<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic FeatureSnappingLayerSource type error in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1097162#M74633</link>
    <description>&lt;P&gt;The ES Module &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-FeatureSnappingLayerSource.html" target="_blank" rel="noopener"&gt;FeatureSnappingLayerSource&lt;/A&gt; produces an incorrect typing error when setting &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html" target="_self"&gt;SnappingOptions&lt;/A&gt; on Sketch:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._layer = new GraphicsLayer();
this._mapView.map.add(this._layer);

this._sketchVM = new SketchViewModel({
  view: this._mapView,
  layer: this._layer,
  snappingOptions: {
    enabled: true,
    featureSources: [{
      layer: this._layer  /** type error **/
    }]
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;Type error:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;LI-SPOILER&gt;&lt;DIV&gt;No overload matches this call.&lt;/DIV&gt;&lt;DIV&gt;Overload 1 of 2, '(properties?: SketchViewModelProperties): SketchViewModel', gave the following error.&lt;/DIV&gt;&lt;DIV&gt;Type '{ layer: esri.GraphicsLayer; }' is not assignable to type 'FeatureSnappingLayerSourceProperties'.&lt;/DIV&gt;&lt;DIV&gt;Object literal may only specify known properties, and &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'layer' does not exist in type 'FeatureSnappingLayerSourceProperties'&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/DIV&gt;&lt;DIV&gt;Overload 2 of 2, '(properties?: SketchViewModelProperties): SketchViewModel', gave the following error.&lt;/DIV&gt;&lt;DIV&gt;Type '{ layer: esri.GraphicsLayer; }' is not assignable to type 'FeatureSnappingLayerSourceProperties'.&lt;/DIV&gt;&lt;DIV&gt;Object literal may only specify known properties, and 'layer' does not exist in type 'FeatureSnappingLayerSourceProperties'.&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;ts&lt;/SPAN&gt;&lt;SPAN class=""&gt;(2769)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI-SPOILER&gt;&lt;DIV&gt;The error occurs because FeatureSnappingLayerSourceProperties type does not have a 'layer' property. The &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=sketch-snapping-magnifier" target="_blank" rel="noopener"&gt;same code&lt;/A&gt; above works with AMD which has no type checking. Works when adding TS ignore:&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._sketchVM = new SketchViewModel({
  view: this._mapView,
  layer: this._layer,
  snappingOptions: {
    enabled: true,
    featureSources: [{
      // @ts-ignore: Type definition bug 
      layer: this._layer
    }]
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Requesting this be fixed in a future release.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Sep 2021 13:25:21 GMT</pubDate>
    <dc:creator>ShaneBuscher</dc:creator>
    <dc:date>2021-09-10T13:25:21Z</dc:date>
    <item>
      <title>FeatureSnappingLayerSource type error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1097162#M74633</link>
      <description>&lt;P&gt;The ES Module &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-FeatureSnappingLayerSource.html" target="_blank" rel="noopener"&gt;FeatureSnappingLayerSource&lt;/A&gt; produces an incorrect typing error when setting &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html" target="_self"&gt;SnappingOptions&lt;/A&gt; on Sketch:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._layer = new GraphicsLayer();
this._mapView.map.add(this._layer);

this._sketchVM = new SketchViewModel({
  view: this._mapView,
  layer: this._layer,
  snappingOptions: {
    enabled: true,
    featureSources: [{
      layer: this._layer  /** type error **/
    }]
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;Type error:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;LI-SPOILER&gt;&lt;DIV&gt;No overload matches this call.&lt;/DIV&gt;&lt;DIV&gt;Overload 1 of 2, '(properties?: SketchViewModelProperties): SketchViewModel', gave the following error.&lt;/DIV&gt;&lt;DIV&gt;Type '{ layer: esri.GraphicsLayer; }' is not assignable to type 'FeatureSnappingLayerSourceProperties'.&lt;/DIV&gt;&lt;DIV&gt;Object literal may only specify known properties, and &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;'layer' does not exist in type 'FeatureSnappingLayerSourceProperties'&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/DIV&gt;&lt;DIV&gt;Overload 2 of 2, '(properties?: SketchViewModelProperties): SketchViewModel', gave the following error.&lt;/DIV&gt;&lt;DIV&gt;Type '{ layer: esri.GraphicsLayer; }' is not assignable to type 'FeatureSnappingLayerSourceProperties'.&lt;/DIV&gt;&lt;DIV&gt;Object literal may only specify known properties, and 'layer' does not exist in type 'FeatureSnappingLayerSourceProperties'.&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;ts&lt;/SPAN&gt;&lt;SPAN class=""&gt;(2769)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI-SPOILER&gt;&lt;DIV&gt;The error occurs because FeatureSnappingLayerSourceProperties type does not have a 'layer' property. The &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=sketch-snapping-magnifier" target="_blank" rel="noopener"&gt;same code&lt;/A&gt; above works with AMD which has no type checking. Works when adding TS ignore:&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._sketchVM = new SketchViewModel({
  view: this._mapView,
  layer: this._layer,
  snappingOptions: {
    enabled: true,
    featureSources: [{
      // @ts-ignore: Type definition bug 
      layer: this._layer
    }]
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Requesting this be fixed in a future release.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 13:25:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1097162#M74633</guid>
      <dc:creator>ShaneBuscher</dc:creator>
      <dc:date>2021-09-10T13:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureSnappingLayerSource type error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1097180#M74634</link>
      <description>&lt;P&gt;It's because snappingOptions is using autocasting. From the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-interactive-snapping-SnappingOptions.html" target="_self"&gt;docs&lt;/A&gt;:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Create a new instance of Sketch, and set
// a layer for one of the featureSources property.
// This enables feature snapping on that layer.
const sketch = new Sketch({
  layer: graphicsLayer,
  view: view,
  snappingOptions: { // autocasts to SnappingOptions()
    enabled: true,
    featureSources: [{ layer: graphicsLayer }] // autocasts to FeatureSnappingLayerSource()
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TypeScript doesn't allow for that, so you'll have to create a new SnappingOptions&lt;/P&gt;</description>
      <pubDate>Fri, 10 Sep 2021 13:51:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1097180#M74634</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-09-10T13:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureSnappingLayerSource type error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1100054#M74720</link>
      <description>&lt;P&gt;Actually newing up SnappingOptions produces the same TS error because the layer property on FeatureSnappingLayerSource is not defined (as originally posted).&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const options = new SnappingOptions({
      enabled: true,
      featureSources: [new FeatureSnappingLayerSource({ layer: this._layer }]
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&amp;nbsp;&lt;SPAN&gt;Object literal may only specify known properties, and 'layer' does not exist in type 'FeatureSnappingLayerSourceProperties'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 19:22:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1100054#M74720</guid>
      <dc:creator>ShaneBuscher</dc:creator>
      <dc:date>2021-09-20T19:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureSnappingLayerSource type error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1142259#M76305</link>
      <description>&lt;P&gt;VS code will bark because it says the layer property is read only.&amp;nbsp; Create a new generic object (or array of objects) and set it to the featureSources:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const fs:any = {layer: this._layer};

const sketch = new Sketch({
layer: graphicsLayer,
view: view,
snappingOptions: { // autocasts to SnappingOptions()
enabled: true,
featureSources: [fs] 
}
});
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 18:26:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featuresnappinglayersource-type-error/m-p/1142259#M76305</guid>
      <dc:creator>DWVHB</dc:creator>
      <dc:date>2022-02-09T18:26:13Z</dc:date>
    </item>
  </channel>
</rss>

