Defining model properties in JavaScript - is there a need

I am creating a Node.js API and i keep changing my mind with regards to defining properties for my models or not.

Coming from .Net and c# i am used to defining the properties of a class but as that is as statically defined language that makes sense. With javascript being so dynamic it feels a little dirty and i really am not sure why.

It's been a long week so i may be just complicating things and should continue but any insight would be great.

Simple example with some properties

var Post = exports = module.exports = function(postData){
    var post = postData || {};

    //Set Properties
    this.id = post.id || 0;
    this.message = post.message || '';
};

If you don't have some form of schema, then how do you plan to read the data?

If you're planning to put data in a Database and then actually read that data back out, you need a schema. Even with the fancy "schema-less" NoSQL database, you still need some way of understanding the data that comes back "schema-less" != "schema-free".

If you look at the various Javascript DB frameworks, there are lots of wrappers that enforce some kind of schema: Mongoose for MongoDB, Geddy JS has a universal "Model" type. Even without static typing you want some form of tool to know what's in the object you're getting back.

i keep changing my mind with regards to defining properties for my models

C# has a very specific definition of "property". In that sense, you probably don't want "properties", but you probably do want "fields".

With javascript being so dynamic it feels a little dirty and i really am not sure why.

As a user with an MS background, you may want to consider Microsoft's TypeScript. It actually has an NPM package and provides basic typing that will compile into regular Javascript.