objection.js icon indicating copy to clipboard operation
objection.js copied to clipboard

Static methods not exposed on Model Type

Open elby22 opened this issue 5 years ago • 2 comments

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.

elby22 avatar Oct 29 '20 23:10 elby22

I run into the same problem :) !

yukulelix avatar Jan 06 '22 18:01 yukulelix

I have the same problem! Some methods are missing from the typings.

ducher avatar Apr 19 '22 14:04 ducher

I'd be happy to review a PR adding these typings

lehni avatar Apr 15 '23 08:04 lehni

I'd be happy to review a PR adding these typings

Here it is! 😉

cesumilo avatar Feb 28 '24 14:02 cesumilo

Closed by #2612

lehni avatar Feb 28 '24 18:02 lehni