cap-js / cds-types

Type definitions for CDS
Apache License 2.0
9 stars 8 forks source link

CSN is also a valid option for model to connect #209

Open ThePlenkov opened 2 weeks ago

ThePlenkov commented 2 weeks ago

I use a preloaded model to connect to the database and it works. However TS doesn't allow to use. This PR fixes it.

  const model = await cds.load('models/public');
 const db = await cds.connect.to('db', {
    model: model as any,
    kind: 'hana',
    credentials: requires?.db?.credentials,
  });
daogrady commented 2 weeks ago

Hi Petr,

thanks for the contribution! @johannes-vogel @David-Kunz could one of you please confirm that this is valid? Thanks!

Best, Daniel