TypeScript override ToString()
<p>Let's say I have a class <code>Person</code> which looks like this:</p>
<pre><code>class Person {
    constructor(
        public firstName: string,
        public lastName: string,
        public age: number
    ) {}
}
</code></pre>
<p>I have overridden the <code>toString</code> method as follows.</p>
<pre><code>public toString(): string {
    return this.firstName + ' ' + this.lastName;
}
</code></pre>
<p>Now I expect to be able to do the following, which works in runtime:</p>
<pre><code>function alertMessage(message: string) {
    alert(message);
}

alertMessage(new Person('John', 'Smith', 20));
</code></pre>
<p>But this still gives me this error:</p>
<blockquote>
<p>TS2345: Argument of type 'Person' is not assignable to parameter of type 'string'.</p>
</blockquote>
<p>How can I assign a <code>Person</code> to this <code>string</code> argument?</p>