Typescript interfaces behaving differently when used as part of constructor invocation vs regular function?

Why does the 1st example compile but the 2nd one generates "Supplied parameters do not match any signature of call target?"

interface Foo {
    s: string;
}

// example 1:
function abc(p: Foo[]) {    
}

// ok
abc([{s: ''}]);


// example 2:
class Blah {
    constructor(p: {stuff: Foo[]}) {
    }
}

// not ok: Supplied parameters do not match any signature of call target
var obj = new Blah({stuff: [{s: ''}]});

Answers


This was a bug in the compiler. It's been fixed; the next release that will have the fix is 0.9.1.0.


Need Your Help

Get Monthly Totals from Running Totals

sql sql-server sql-server-2008

I have a table in a SQL Server 2008 database with two columns that hold running totals called Hours and Starts. Another column, Date, holds the date of a record. The dates are sporadic throughout any

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.