Make a chain of methods with TypeScript
<p>I have an array of countries defined as a const <code>CountriesList</code>:</p>

<pre><code>[{
    name: "Afghanistan",
    id: "4",
    alpha2Code: "AF",
    alpha3Code: "AFG",
    numericCode: 4
},
...]
</code></pre>

<p>I have a static class <code>Countries</code> which is supposed to return differently formatted and filtered countries from the const above.</p>

<pre><code>export class Countries {
public static getCountries() {
    return CountriesList;
}

public static getFilteredCountries(setName: string) {
    return CountriesList
        .filter(function (country, index) {
            return customFilter(setName, country, index)
        });
}

public static formatForSelectInput(items: ICountryIso3166[]) {
    return items.map(function (country) {
        return {
            title: L(country.name),
            data: country.id,
            value: country.name
        };
    })
}
}
</code></pre>

<p>Now, as it's TypeScript and it has its own rules, I have no idea how to chain methods to make it work like this:</p>

<pre><code>var countryItems = Countries
    .getFilteredCountries('test')
    .formatForSelectInput();
</code></pre>

<p>Should I create a new object, so that not to return bare array, but an array inside a wrapper object with respective methods, or how do I perform the chaining properly?</p>

<p>Please advise.</p>