Changed internal types from class to interface

Thanks to  @pfzero
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/7021#issuecomment-179439322
This commit is contained in:
CaselIT
2016-02-03 21:50:31 +01:00
parent 9e2b6c0c0c
commit a80a024f79
+19 -11
View File
@@ -11,6 +11,7 @@
declare module "mongodb" {
import {EventEmitter} from 'events';
// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html
export class MongoClient {
constructor();
@@ -150,7 +151,7 @@ declare module "mongodb" {
socketOptions?: SocketOptions;
}
// Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html
// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html
export class Db extends EventEmitter {
constructor(databaseName: string, serverConfig: Server | ReplSet | Mongos, options?: DbCreateOptions);
@@ -322,7 +323,7 @@ declare module "mongodb" {
}
// http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html
export class Admin {
export interface Admin {
// http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser
addUser(username: string, password: string, callback: MongoCallback<any>): void;
addUser(username: string, password: string, options?: AddUserOptions): Promise<any>;
@@ -552,7 +553,7 @@ declare module "mongodb" {
}
// Documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html
export class Collection {
export interface Collection {
// Get the collection name.
collectionName: string;
// Get the full collection namespace.
@@ -871,7 +872,7 @@ declare module "mongodb" {
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html
export class OrderedBulkOperation {
export interface OrderedBulkOperation {
length: number;
//http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute
execute(callback: MongoCallback<BulkWriteResult>): void;
@@ -884,7 +885,14 @@ declare module "mongodb" {
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html
export class BulkWriteResult {
export interface BulkWriteResult {
ok: boolean;
nInserted: number;
nUpdated: number;
nUpserted: number;
nModified: number;
nRemoved: number;
getInsertedIds(): Array<Object>;
getLastOp(): Object;
getRawResponse(): Object;
@@ -916,7 +924,7 @@ declare module "mongodb" {
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsOrdered.html
export class FindOperatorsOrdered {
export interface FindOperatorsOrdered {
delete(): OrderedBulkOperation;
deleteOne(): OrderedBulkOperation;
replaceOne(doc: Object): OrderedBulkOperation;
@@ -926,7 +934,7 @@ declare module "mongodb" {
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html
export class UnorderedBulkOperation {
export interface UnorderedBulkOperation {
//http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute
execute(callback: MongoCallback<BulkWriteResult>): void;
execute(options: FSyncOptions): Promise<BulkWriteResult>;
@@ -938,7 +946,7 @@ declare module "mongodb" {
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsUnordered.html
export class FindOperatorsUnordered {
export interface FindOperatorsUnordered {
length: number;
remove(): UnorderedBulkOperation;
removeOne(): UnorderedBulkOperation;
@@ -1044,7 +1052,7 @@ declare module "mongodb" {
export type CursorResult = any | void | boolean;
//http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html
export class Cursor extends EventEmitter implements Readable {
export interface Cursor extends Readable, NodeJS.EventEmitter {
sortValue: string;
timeout: boolean;
@@ -1161,7 +1169,7 @@ declare module "mongodb" {
export type AggregationCursorResult = any | void;
//http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html
export class AggregationCursor extends EventEmitter implements Readable {
export interface AggregationCursor extends Readable, NodeJS.EventEmitter {
// http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#batchSize
batchSize(value: number): AggregationCursor;
// http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#clone
@@ -1225,7 +1233,7 @@ declare module "mongodb" {
}
//http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html
export class CommandCursor extends EventEmitter implements Readable {
export interface CommandCursor extends Readable, NodeJS.EventEmitter {
// http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#batchSize
batchSize(value: number): CommandCursor;
// http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#clone