eveningkid / denodb

MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
https://eveningkid.com/denodb-docs
MIT License
1.93k stars 129 forks source link

DenoDB Models' fields without Types? #384

Open tachyon-ops opened 7 months ago

tachyon-ops commented 7 months ago

Hi all,

Great software. I am working my way through it and loving it.

I have one question: I am following your example

class Flight extends Model {
  static table = 'flights';
  static timestamps = true;

  static fields = {
    id: { primaryKey: true, autoIncrement: true },
    departure: DataTypes.STRING,
    destination: DataTypes.STRING,
    flightDuration: DataTypes.FLOAT,
  };

  static defaults = {
    flightDuration: 2.5,
  };
}

const flight = new Flight();
flight.departure = 'London';
flight.destination = 'San Francisco';
await flight.save();

But flight.departure doesn't exist in Flight. Anyone could let me know why we can't try to add autocompletion/types to the fields? Or am I doing something wrong?

Regards, N