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

Class 'Model<T, R>' incorrectly implements interface 'IModel<T, R>'

Open Synthx opened this issue 3 years ago • 8 comments

Hello, I'm currently using Ottoman for my Couchbase server SDK, But when I'm trying to build with tsc, I got the following 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 13 more.

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

Node version : v16.13.2 Npm version : 8.5.5 Ottoman version : 2.2.0

TSConfig file :

{
    "compilerOptions": {
        "module": "commonjs",
        "esModuleInterop": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noImplicitReturns": true,
        "noImplicitAny": false,
        "noUnusedLocals": true,
        "resolveJsonModule": true,
        "outDir": "lib",
        "sourceMap": true,
        "strict": true,
        "target": "es2017",
        "types": ["node", "puppeteer"]
    },
    "compileOnSave": true,
    "include": ["src"]
}

Thanks for your help

Synthx avatar Mar 31 '22 07:03 Synthx

hi @Synthx

In order to solve it as quick as possible check the suggestions below: you can use: tsc --skipLibCheck

or update TSConfig with: skipLibCheck: true

@Synthx What typescript version are you using?

Greetings.

gsi-alejandro avatar Mar 31 '22 16:03 gsi-alejandro

Hi, my typescript version is ^4.4.4

Synthx avatar Apr 01 '22 05:04 Synthx

Thank you @Synthx.

I will check this typescript version. (Ottoman was built with 4.3.5)

for this reason, I suggest the 2 solutions above.

@Synthx the problem was solved by using skipLibCheck option?

gsi-alejandro avatar Apr 01 '22 14:04 gsi-alejandro

Sorry, for not responded, still the same issue by downgrading my typescript version to 4.3.5 when i use skipLibCheck option I got a TypeError:

 return series_1.SeriesModel.find({ _active: true }, { select: 'slug' });
                                    ^

TypeError: Cannot read properties of undefined (reading 'find')

Synthx avatar Apr 08 '22 16:04 Synthx

Hi @Synthx

Do you have the code in a public repor or can share a little script reproducing it, to can check and correct this.

Or any other clue to help us to reproduce this issue?

gsi-alejandro avatar Apr 08 '22 18:04 gsi-alejandro

I'm having the same problem and I guess this issue is a duplicate of #604.

kishmiryan-karlen avatar Apr 21 '22 12:04 kishmiryan-karlen

Duplicated: please check https://github.com/couchbaselabs/node-ottoman/issues/604.

gsi-alejandro avatar Apr 21 '22 16:04 gsi-alejandro

Is this resolved? I am also unable to install ottoman NPM 8.5.5 Node: 17.8.0

caw-ishikajain avatar Aug 27 '22 13:08 caw-ishikajain

@gsi-alejandro assuming this is resolved ?

AV25242 avatar Oct 10 '22 20:10 AV25242

I just ran into this as well.

Edit: Here is a test repo. https://github.com/busheezy/node-ottoman-type-error/blob/main/tsconfig.json#L8-L9

If you try to use module: commonjs or moduleResolution: node, it dies.

busheezy avatar Oct 14 '22 14:10 busheezy

Duplicated: please check https://github.com/couchbaselabs/node-ottoman/issues/604.

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