<?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 Possible error in API type delcarations index.d.ts in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/possible-error-in-api-type-delcarations-index-d-ts/m-p/120243#M11207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In&amp;nbsp;&lt;A href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-4.html" style="color: #2989c5; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;version 2.4&lt;/A&gt;&amp;nbsp;(Dec. 2017), TypeScript introduced the concept of a weak type. A weak type is any type that is defined by only optional properties.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="background: none #f6f6f6; border-left: 2px solid #cccccc; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="color: #242424; background-color: #ffffff;"&gt;Any type that contains nothing but a set of all-optional properties is considered to be&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="color: #242424; background-color: #ffffff; font-size: 16px;"&gt;weak&lt;/EM&gt;&lt;SPAN style="color: #242424; background-color: #ffffff;"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As defined in the type declarations file for the ArcGIS API for JavaScript (node_modules/@types/arcgis-api-js/index.d.ts), the interface RendererProperties defines a weak type, since it specifies only one property and that property is optional.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; &lt;SPAN class="" style="color: #0077aa;"&gt;export&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa;"&gt;const&lt;/SPAN&gt; Renderer&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; RendererConstructor&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;

  &lt;SPAN class="" style="color: #0077aa;"&gt;interface&lt;/SPAN&gt; &lt;SPAN class=""&gt;RendererProperties&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="" style="color: slategray;"&gt;/**
     * Authoring metadata only included in renderers generated from one of the Smart Mapping creator methods, such as ...
     *
     * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#authoringInfo)
     */&lt;/SPAN&gt;
    authoringInfo&lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;?&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; AuthoringInfoProperties&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;

  &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Typescript disallows assigning weak types to objects when there is no overlap in properties between the type declaration and the object's properties. In other words, even though all properties of a weak type are optional, an object must have at least one of them in order to be assigned that type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case of the RendererProperties type, this means that no object can be assigned the type RendererProperties unless it has an authoringInfo property. This is a rather undesirable requirement, as there are many use cases for the Renderer type that do not necessitate an authoringInfo property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, consider the following code from the official API sample code --&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-featurelayer-collection" style="color: #2989c5; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;Sandbox link here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #0077aa;"&gt;var&lt;/SPAN&gt; quakesRenderer &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
        type&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"simple"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// autocasts as new SimpleRenderer()&lt;/SPAN&gt;
        symbol&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
          type&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"simple-marker"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// autocasts as new SimpleMarkerSymbol()&lt;/SPAN&gt;
          style&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"circle"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
          size&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;20&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
          color&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #990000;"&gt;211&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;255&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
          outline&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
            width&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
            color&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"#FF0055"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
            style&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"solid"&lt;/SPAN&gt;
          &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
        visualVariables&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;[&lt;/SPAN&gt;
        &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
          &lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// omitted for brevity&lt;/SPAN&gt;

        &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;]&lt;/SPAN&gt;
      &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

&lt;SPAN class="" style="color: #0077aa;"&gt;function&lt;/SPAN&gt; &lt;SPAN class="" style="color: #d74444;"&gt;createLayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;graphics&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;

        layer &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa;"&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
          source&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; graphics&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// autocast as an array of esri/Graphic&lt;/SPAN&gt;
          &lt;SPAN class="" style="color: slategray;"&gt;// create an instance of esri/layers/support/Field for each field object&lt;/SPAN&gt;
          fields&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; fields&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// This is required when creating a layer from Graphics&lt;/SPAN&gt;
          objectIdField&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"ObjectID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// This must be defined when creating a layer from Graphics&lt;/SPAN&gt;
          renderer&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; quakesRenderer&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// ** autocast attempts to assign type RendererProperties, but cannot&lt;/SPAN&gt;
          popupTemplate&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; pTemplate
        &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;

        map&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444;"&gt;add&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="" style="color: #0077aa;"&gt;return&lt;/SPAN&gt; layer&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;

‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example&amp;nbsp;does not work in TypeScript.&amp;nbsp;When the FeatureLayer constructor is called in line 23, TypeScript attempts to cast the object passed to it to type FeatureLayerProperties. This, in turn, requires that the value of the renderer property be cast to type RendererProperties. However, this cast fails, as RendererProperties is a weak type and quakesRenderer has no properties that overlap with it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One fairly reasonable, very easy fix would be to add an index signature with type any to the RendererProperties interface to ensure that any properties will be accepted. This is perhaps a bit hacky, but it would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; interface RendererProperties {
    /**
     * Authoring metadata only included in renderers generated from one of the Smart Mapping creator methods, such as [sizeRendererCreator.createContinuousRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createContinuousRenderer) or [colorRendererCreator.createContinuousRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createContinuousRenderer). This includes information from UI elements such as sliders and selected classification methods and themes. This allows the authoring clients to save specific overridable settings so that next time it is accessed via the UI, their selections can be remembered.
     *
     * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#authoringInfo)
     */
    authoringInfo?: AuthoringInfoProperties;

    [prop: string]: any;

  }&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something, or is this, in fact, an error in the API's type declarations?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:00:00 GMT</pubDate>
    <dc:creator>TristanLopus1</dc:creator>
    <dc:date>2021-12-11T07:00:00Z</dc:date>
    <item>
      <title>Possible error in API type delcarations index.d.ts</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/possible-error-in-api-type-delcarations-index-d-ts/m-p/120243#M11207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In&amp;nbsp;&lt;A href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-4.html" style="color: #2989c5; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;version 2.4&lt;/A&gt;&amp;nbsp;(Dec. 2017), TypeScript introduced the concept of a weak type. A weak type is any type that is defined by only optional properties.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro" style="background: none #f6f6f6; border-left: 2px solid #cccccc; margin: 10px 0px; padding: 10px 20px;"&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="color: #242424; background-color: #ffffff;"&gt;Any type that contains nothing but a set of all-optional properties is considered to be&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="color: #242424; background-color: #ffffff; font-size: 16px;"&gt;weak&lt;/EM&gt;&lt;SPAN style="color: #242424; background-color: #ffffff;"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As defined in the type declarations file for the ArcGIS API for JavaScript (node_modules/@types/arcgis-api-js/index.d.ts), the interface RendererProperties defines a weak type, since it specifies only one property and that property is optional.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; &lt;SPAN class="" style="color: #0077aa;"&gt;export&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa;"&gt;const&lt;/SPAN&gt; Renderer&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; RendererConstructor&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;

  &lt;SPAN class="" style="color: #0077aa;"&gt;interface&lt;/SPAN&gt; &lt;SPAN class=""&gt;RendererProperties&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="" style="color: slategray;"&gt;/**
     * Authoring metadata only included in renderers generated from one of the Smart Mapping creator methods, such as ...
     *
     * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#authoringInfo)
     */&lt;/SPAN&gt;
    authoringInfo&lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;?&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; AuthoringInfoProperties&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;

  &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Typescript disallows assigning weak types to objects when there is no overlap in properties between the type declaration and the object's properties. In other words, even though all properties of a weak type are optional, an object must have at least one of them in order to be assigned that type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the case of the RendererProperties type, this means that no object can be assigned the type RendererProperties unless it has an authoringInfo property. This is a rather undesirable requirement, as there are many use cases for the Renderer type that do not necessitate an authoringInfo property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, consider the following code from the official API sample code --&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-featurelayer-collection" style="color: #2989c5; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;Sandbox link here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #0077aa;"&gt;var&lt;/SPAN&gt; quakesRenderer &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
        type&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"simple"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// autocasts as new SimpleRenderer()&lt;/SPAN&gt;
        symbol&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
          type&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"simple-marker"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// autocasts as new SimpleMarkerSymbol()&lt;/SPAN&gt;
          style&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"circle"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
          size&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;20&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
          color&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #990000;"&gt;211&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;255&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
          outline&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
            width&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #990000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
            color&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"#FF0055"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
            style&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"solid"&lt;/SPAN&gt;
          &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;
        &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt;
        visualVariables&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;[&lt;/SPAN&gt;
        &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
          &lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// omitted for brevity&lt;/SPAN&gt;

        &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;]&lt;/SPAN&gt;
      &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

&lt;SPAN class="" style="color: #0077aa;"&gt;function&lt;/SPAN&gt; &lt;SPAN class="" style="color: #d74444;"&gt;createLayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;graphics&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt; &lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;

        layer &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5);"&gt;=&lt;/SPAN&gt; &lt;SPAN class="" style="color: #0077aa;"&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;{&lt;/SPAN&gt;
          source&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; graphics&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// autocast as an array of esri/Graphic&lt;/SPAN&gt;
          &lt;SPAN class="" style="color: slategray;"&gt;// create an instance of esri/layers/support/Field for each field object&lt;/SPAN&gt;
          fields&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; fields&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// This is required when creating a layer from Graphics&lt;/SPAN&gt;
          objectIdField&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; &lt;SPAN class="" style="color: #669900;"&gt;"ObjectID"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// This must be defined when creating a layer from Graphics&lt;/SPAN&gt;
          renderer&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; quakesRenderer&lt;SPAN class="" style="color: #999999;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="" style="color: slategray;"&gt;// ** autocast attempts to assign type RendererProperties, but cannot&lt;/SPAN&gt;
          popupTemplate&lt;SPAN class="" style="color: #999999;"&gt;:&lt;/SPAN&gt; pTemplate
        &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;

        map&lt;SPAN class="" style="color: #999999;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #d74444;"&gt;add&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="" style="color: #999999;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="" style="color: #0077aa;"&gt;return&lt;/SPAN&gt; layer&lt;SPAN class="" style="color: #999999;"&gt;;&lt;/SPAN&gt;
      &lt;SPAN class="" style="color: #999999;"&gt;}&lt;/SPAN&gt;

‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example&amp;nbsp;does not work in TypeScript.&amp;nbsp;When the FeatureLayer constructor is called in line 23, TypeScript attempts to cast the object passed to it to type FeatureLayerProperties. This, in turn, requires that the value of the renderer property be cast to type RendererProperties. However, this cast fails, as RendererProperties is a weak type and quakesRenderer has no properties that overlap with it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One fairly reasonable, very easy fix would be to add an index signature with type any to the RendererProperties interface to ensure that any properties will be accepted. This is perhaps a bit hacky, but it would work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; interface RendererProperties {
    /**
     * Authoring metadata only included in renderers generated from one of the Smart Mapping creator methods, such as [sizeRendererCreator.createContinuousRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-size.html#createContinuousRenderer) or [colorRendererCreator.createContinuousRenderer()](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-smartMapping-creators-color.html#createContinuousRenderer). This includes information from UI elements such as sliders and selected classification methods and themes. This allows the authoring clients to save specific overridable settings so that next time it is accessed via the UI, their selections can be remembered.
     *
     * [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-Renderer.html#authoringInfo)
     */
    authoringInfo?: AuthoringInfoProperties;

    [prop: string]: any;

  }&lt;SPAN class="" style="border-right: 1px solid #999999; padding-top: 1em;"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something, or is this, in fact, an error in the API's type declarations?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:00:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/possible-error-in-api-type-delcarations-index-d-ts/m-p/120243#M11207</guid>
      <dc:creator>TristanLopus1</dc:creator>
      <dc:date>2021-12-11T07:00:00Z</dc:date>
    </item>
  </channel>
</rss>

