node-ottoman icon indicating copy to clipboard operation
node-ottoman copied to clipboard

Error import with TypeScript in framework Nest.js

Open Max110011 opened this issue 4 years ago • 7 comments

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> {

Max110011 avatar Aug 29 '21 15:08 Max110011

Hi @Max110011 which version of Ottoman are you using ?

AV25242 avatar Aug 30 '21 15:08 AV25242

Version Ottoman "2.0.0-beta.8"

Max110011 avatar Aug 31 '21 11:08 Max110011

Version NestJs "7.5.1"

Max110011 avatar Aug 31 '21 11:08 Max110011

hi @Max110011

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

Greetings.

gsi-alejandro avatar Aug 31 '21 12:08 gsi-alejandro

TANKS Thank you work

Max110011 avatar Aug 31 '21 13:08 Max110011

Hi @Max110011 can you close this if this helped ?

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

AV25242 avatar Aug 31 '21 16:08 AV25242

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.

mpaauw avatar Oct 06 '21 15:10 mpaauw

Agreed, we will address it in this ticket

gsi-alejandro avatar Oct 18 '22 14:10 gsi-alejandro

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

gsi-alejandro avatar Jan 17 '23 18:01 gsi-alejandro