<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I tried using the <code class="notranslate">@types/xxxx</code> package and had problems.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I tried using the latest stable version of tsc. <a href="https://www.npmjs.com/package/typescript" rel="nofollow">https://www.npmjs.com/package/typescript</a></li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have a question that is inappropriate for <a href="https://stackoverflow.com/" rel="nofollow">StackOverflow</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> <a href="https://github.com/blog/821-mention-somebody-they-re-notified">Mention</a> the authors (see <code class="notranslate">Definitions by:</code> in <code class="notranslate">index.d.ts</code>) so they can respond.
<ul dir="auto">
<li>Authors: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/FDIM/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/FDIM">@FDIM</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/kolodny/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/kolodny">@kolodny</a>  (didn't know who to pick and it seemed a bit excessive to mention all, so I picked two random names out of the list, hope that's appropriate)</li>
</ul>
</li>
</ul>
<p dir="auto">I have a freshly updated Angular project with the latest TypeScript 3.5.2 and jasmine 3.3.13. During testing, I got an error with one of my mock objects.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export class AuthServiceMock {
	constructor() {
		spyOn(this, 'logoff');
	}

	logoff() { }
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-smi">AuthServiceMock</span> <span class="pl-kos">{</span>
	<span class="pl-en">constructor</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
		<span class="pl-en">spyOn</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">,</span> <span class="pl-s">'logoff'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
	<span class="pl-kos">}</span>

	<span class="pl-en">logoff</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This test code used to work, but now using <code class="notranslate">spyOn()</code> gives an error:</p>
<blockquote>
<p dir="auto">Argument of type '"logoff"' is not assignable to parameter of type 'this["logoff"] extends Function ? "logoff" : never'.ts(2345)</p>
</blockquote>
<p dir="auto">It's easily circumventable using <code class="notranslate">as</code>:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="spyOn(this as AuthServiceMock, 'logoff');"><pre class="notranslate"><span class="pl-en">spyOn</span><span class="pl-kos">(</span><span class="pl-smi">this</span> <span class="pl-k">as</span> <span class="pl-smi">AuthServiceMock</span><span class="pl-kos">,</span> <span class="pl-s">'logoff'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">But this shouldn't be necessary, so I thought I'd share my findings.</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const x = _.chain([1]).value();"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">_</span><span class="pl-kos">.</span><span class="pl-en">chain</span><span class="pl-kos">(</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">value</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Type of <code class="notranslate">x</code> is <code class="notranslate">ArrayLike&lt;number&gt;</code>. But it should be <code class="notranslate">number[]</code>;</p>
<p dir="auto">/cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/aj-r/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/aj-r">@aj-r</a></p>