i am trying to use mongodb typings which i installed via
npm install @types/mongodb -D
now i want to use the types in a function like that
export default async function insertOne(collection:any, data:any):Promise<MongoClient.Collection.InsertOneWriteOpResult> {
let db = await state.db
let col = await db.collection(collection)
let result = await col.insertOne(data)
return result
}
i am specifically interested in the Type of InsertOneWriteOpResult. but i am getting the typescript compiler error:
src/utils/mongodb/collection/insert-one.ts|5 col 17 error| Cannot find namespace 'MongoClient'.
i referenced the typings file in my typings.d.ts
/// <reference path="./../node_modules/@types/mongodb/index.d.ts" />
So my question is, which namespace do i have to use to let typescript check against InsertOptionsWriteOpResult?
via divramod
No comments:
Post a Comment