couchbaselabs / node-ottoman

Node.js ODM for Couchbase
https://ottomanjs.com/
Apache License 2.0
286 stars 98 forks source link

Error import with TypeScript in framework Nest.js #568

Closed Max110011 closed 1 year ago

Max110011 commented 2 years ago

Example Import:

import { Ottoman, set } from 'ottoman'

const ottoman = new Ottoman() ottoman.connect(config.db)

Error: node_modules/ottoman/lib/types/model/model.d.ts:8:22 - error TS2420: Class 'Model<T, R>' incorrectly implements interface 'IModel<T, R>'. Type 'Model<T, R>' is missing the following properties from type 'IModel<T, R>': find, count, findById, findOne, and 11 more.

8 export declare class Model<T = any, R = any> extends Document implements IModel<T, R> {

AV25242 commented 2 years ago

Hi @Max110011 which version of Ottoman are you using ?

Max110011 commented 2 years ago

Version Ottoman "2.0.0-beta.8"

Max110011 commented 2 years ago

Version NestJs "7.5.1"

gsi-alejandro commented 2 years ago

hi @Max110011

A quick solution could be by setting in your tsconfig.json the option: "skipLibCheck": true

Greetings.

Max110011 commented 2 years ago

TANKS Thank you work

AV25242 commented 2 years ago

Hi @Max110011 can you close this if this helped ?

@gsi-alejandro why are we seeing this issue is there any other permanent fix ?

mpaauw commented 2 years ago

Seeing this issue as well; I'm on version 2.0.0.

Adding "skipLibCheck": true to my tsconfig.json is fine as a temporary workaround, but this issue should be looked into further.

gsi-alejandro commented 1 year ago

Agreed, we will address it in this ticket

gsi-alejandro commented 1 year ago

The next Ottoman release will enable typescript users to use ottoman without the skipLibCheck flag if they want to.