Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

RN: Class static side 'typeof *' incorrectly extends base class static side 'typeof BaseModel

$
0
0

In react native, I'm extending an ORM class (according to its documentation) but I'm getting following error in VSCode TypeScript checker:

Class static side 'typeof Animal' incorrectly extends base class static side 'typeof BaseModel'.  Types of property 'database' are incompatible.    Type '() => Promise<SQLite.WebSQLDatabase>' is not assignable to type 'void'.ts(2417)

In the end it actually works, but I would like to know if there's a way how to define it more properly or more loose so such checker error is not generated.
The ORM module is just JS (not TypeScript)

This is the parent class method in BaseModel:

  static get database() {    throw new Error('DB not defined')  }

This is the extending method of Animal model:

  static get database() {    return async () => SQLite.openDatabase('database.db')  }

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>