Files
DefinitelyTyped/dexie/dexie-tests.ts
Ryan Cavanaugh 5859f63fd3 Keep fixing...
2016-05-05 12:38:52 -07:00

26 lines
501 B
TypeScript

import Dexie from "dexie";
interface IFriend {
id?: number,
name?: string,
age?: number
}
class MyDB extends Dexie {
friends: Dexie.Table<IFriend, number>;
constructor() {
super("MyDB");
this.version(1).stores({
friends: "++id,name,age"
});
}
}
var db = new MyDB();
db.friends.add({name: "Kalle", age: 23}).then(()=>{
db.friends.where('age').below(30).count(count => {
console.log("Num yound friends: " + count);
});
});