<?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 Re: Typescript event inference no longer working in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1687038#M88202</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/690870"&gt;@mpatiiuk&lt;/a&gt;&amp;nbsp;that is indeed the case I had it set to ES2020&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":downcast_face_with_sweat:"&gt;😓&lt;/span&gt;, updating it makes sense based on as you said the system requirements of the api!&lt;/P&gt;</description>
    <pubDate>Thu, 26 Feb 2026 18:17:30 GMT</pubDate>
    <dc:creator>JonathanDawe_BAS</dc:creator>
    <dc:date>2026-02-26T18:17:30Z</dc:date>
    <item>
      <title>Typescript event inference no longer working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1686849#M88198</link>
      <description>&lt;P&gt;With the new version of the ArcGIS JS API I have run the typescript codemod and am now running through addressing any new typescript errors.&lt;/P&gt;&lt;P&gt;With the latest changes I'm finding that in many cases contextual type inference has been broken by the change. For example calling the `.on()` function on a mapview is giving me noImplicitAny errors when trying to handle the event.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import MapView from '@arcgis/core/views/MapView';

const view = new MapView();

view.on('pointer-move', (e) =&amp;gt; {
  // e is inferred as any, noImplicitAny error
  console.log(e.x, e.y);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue is specifically being caused by the EventedMixin abstract class in the Evented.d.ts. If I change the on method type to use an overload it resolves most of the type errors I am now seeing in my codebase.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// rewrite with overload instead of EventedCallback.
on&amp;lt;Type extends EventNames&amp;lt;this&amp;gt;&amp;gt;(
  type: Type,
  listener: (event: this["@eventTypes"][Type]) =&amp;gt; void
): ResourceHandle;
on&amp;lt;Type extends EventNames&amp;lt;this&amp;gt;&amp;gt;(
  type: Type,
  listener: WeakRef&amp;lt;(event: this["@eventTypes"][Type]) =&amp;gt; void&amp;gt;
): ResourceHandle;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2026 11:45:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1686849#M88198</guid>
      <dc:creator>JonathanDawe_BAS</dc:creator>
      <dc:date>2026-02-26T11:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Typescript event inference no longer working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1687008#M88201</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The error you are seeing is likely caused by an outdated "lib" setting in a tsconfig.json file in your project.&lt;/P&gt;&lt;P&gt;In particular, the "lib" setting is likely set to a value older than 2021, which does not include the WeakMap type, causing EventedCallback type to silently fail back to `any`.&lt;/P&gt;&lt;P&gt;We recommend setting "lib" to a more recent value, like es2024. &lt;A href="https://github.com/Esri/jsapi-resources/blob/main/templates/js-maps-sdk-vite/tsconfig.json#L14" target="_blank" rel="noopener"&gt;See recommended example.&lt;/A&gt;&amp;nbsp;For more details, see &lt;A href="https://developers.arcgis.com/javascript/latest/system-requirements/" target="_blank" rel="noopener"&gt;system requirements&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2026 18:02:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1687008#M88201</guid>
      <dc:creator>mpatiiuk</dc:creator>
      <dc:date>2026-02-27T18:02:08Z</dc:date>
    </item>
    <item>
      <title>Re: Typescript event inference no longer working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1687038#M88202</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/690870"&gt;@mpatiiuk&lt;/a&gt;&amp;nbsp;that is indeed the case I had it set to ES2020&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":downcast_face_with_sweat:"&gt;😓&lt;/span&gt;, updating it makes sense based on as you said the system requirements of the api!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Feb 2026 18:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/typescript-event-inference-no-longer-working/m-p/1687038#M88202</guid>
      <dc:creator>JonathanDawe_BAS</dc:creator>
      <dc:date>2026-02-26T18:17:30Z</dc:date>
    </item>
  </channel>
</rss>

