-
Notifications
You must be signed in to change notification settings - Fork 643
Closed
Description
Thanks so much for your help. We were happily deploying objection 1.6.11 in production with Typescript until we upgraded to 2.0.10, and everything went down from there.
My issue is that:
After updating from objection 1.6.11 to 2.0.10, I am seeing the following Typescript errors coming from our Model declarations. We had received no issues prior to the upgrade.
src/db/models/ExampleTable.ts(4,7): error TS2417: Class static side 'typeof ExampleTable' incorrectly extends base class static side 'typeof Model'.
Types of property 'jsonSchema' are incompatible.
Type '{ properties: { id: { type: string; }; property1: { type: string; }; property2: { type: string; }; property3: { type: string; }; }; type: string; }' is not assignable to type 'JSONSchema'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type '"string" | "number" | "boolean" | "object" | "integer" | "array" | "null" | JSONSchemaTypeName[]'.
- We are on the latest version of Knex
- I am aware of issue JsonSchema issue #1615 and have a feeling that it is related. However, I could not find a way to import the JSONSchema type to cast
jsonSchemato.
Here is an example of our Model declaration file:
import objection from "objection";
import path from "path";
class ExampleTable extends objection.Model {
public id?: number;
public property1: number;
public property2?: object;
public property3?: object;
static get tableName() {
return "exampletable";
}
static get idColumn() {
return "id";
}
static get jsonSchema() {
return {
properties: {
id: { type: "integer" },
property1: { type: "integer" },
property2: { type: "string" },
property3: { type: "string" },
},
type: "object"
};
}
}
export default ExampleTable;
Thank you again!
Metadata
Metadata
Assignees
Labels
No labels