objection.js
objection.js copied to clipboard
Static methods not exposed on Model Type
The static methods Model.columnNameToPropertyName() and Model.propertyNameToColumnName() are defined in the docs and are implemented on the Model class, but aren't exposed in typings/objection/index.d.ts.
Typescript complains when I do something like this (User extends Model):
const propName = User.columnNameToPropertyName('first_name');
Type casting User to any satisfies Typescript and outputs the mapped name firstName:
const propName = (<any>User).columnNameToPropertyName('first_name'); console.log(propName);
I'd be happy to submit a PR if someone would confirm it is indeed a bug and not a misunderstanding on my part.
I run into the same problem :) !
I have the same problem! Some methods are missing from the typings.
I'd be happy to review a PR adding these typings
I'd be happy to review a PR adding these typings
Here it is! 😉
Closed by #2612