-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript support #1
Comments
I just now created a TypeScript declaration. If you would review and test it to see if it meets your requirements, I would appreciate it. /// <reference types="node" />
declare module "zangodb" {
export interface Callback { (error: Error): void; }
export interface ResultCallback<T> { (error: Error, result: T): void; }
export interface IteratorCallback { (doc: any): void; }
export class Cursor extends NodeJS.EventEmitter {
filter(expr: Object): Cursor;
forEach(fn: IteratorCallback, cb?: Callback): Promise<Object>;
group(spec: Object): Cursor;
hint(path: string): Cursor;
limit(num: number): Cursor;
project(spec: Object): Cursor;
skip(num: number): Cursor;
sort(spec: Object): Cursor;
toArray(cb?: ResultCallback<Object[]>): Promise<Object[]>;
unwind(path: string): Cursor;
}
export class Collection {
name: string;
aggregate(pipeline: Object[]): Cursor;
find(expr: Object, projection_spec?: Object): Cursor;
insert(docs: Object|Object[], cb?: Callback): Promise<void>;
remove(expr: Object, cb?: Callback): Promise<void>;
update(expr: Object, spec: Object, cb?: Callback): Promise<void>;
}
export class Db extends NodeJS.EventEmitter {
constructor(name: string, version?: number, config?: string[]|Object);
name: string;
version: number;
close(): void;
collection(name: string): Collection;
drop(cb?: Callback): Promise<void>;
}
} |
@erikolson186 Thanks for the interface, ill extend it as per my requirement. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Implement typescript support for angular2 and ionic2 projects.
The text was updated successfully, but these errors were encountered: