Added test for adding object literals as models

This commit is contained in:
Omid K. Rad
2014-07-16 19:42:09 -07:00
parent d205eb8726
commit c18eb2ad64
+5
View File
@@ -131,6 +131,11 @@ function test_collection() {
var book1: Book = new Book({ title: "Title 1", author: "Mike" });
books.add(book1);
// Objects can be added to collection by casting to model type.
// Compiler will check if object properties are valid for the cast.
// This gives better type checking than declaring an `any` overload.
books.add(<Book>{ title: "Title 2", author: "Mikey" });
var model: Book = book1.collection.first();
if (model !== book1) {
throw new Error("Error");