sylvainpolletvillard / ObjectModel

Strong Dynamically Typed Object Modeling for JavaScript
http://objectmodel.js.org
MIT License
467 stars 30 forks source link

Feature Request: Code Suggestion/IntelliSense on IDE (Jetbrain Webstorm) #132

Closed chhatrachhorm closed 3 years ago

chhatrachhorm commented 3 years ago

I really like this project. It is very useful to help re-structuring my node.js application. All the functionalities are hit to the point.

There is only one request from me is that it would be really great if we can have code suggestion when we navigate through the object of the model class extended from ObjectModel (or any other model provided). For non-nested, less complex objects, we don't really need this, but it is a must for the complex model.

You might say it's an IDE thing and should be handle by IDE, but IDE mostly relies on JSDoc, or proper access modifier and stuff.

It would be wonderful if there is any workaround you could suggest as well. Thank you. And nice work!

sylvainpolletvillard commented 3 years ago

Hello,

The main problem is that this library is about dynamic typing, not static typing. Which means the definition of the models can change over time. IDE autocompletion relies on static analysis and implies the structure can be known before even running the code ; which is not the case for Object models.

If your model definitions are mostly static, maybe you are using ObjectModel only for dynamic validation of external data for example. Then I suggest you to map Object models to either JavaScript ES6 classes or TypeScript interfaces. This way you'll get both static and dynamic typing, and you will be protected both at build time and run time.

crobinson42 commented 3 years ago

Autocomplete could mostly be handled by providing rich Typescript definitions in this library AND the developer was using this library in a TS project.

sylvainpolletvillard commented 3 years ago

I already added typescript definition files for this project. If they could be improved in any way, please PR

sylvainpolletvillard commented 3 years ago

Closed due to inactivity