To get it to work you'll need a postgres database and a .env file containing: PG_USER, PG_PASS and PG_DBNAME.
Then:
- run
npm install - run
npm run create-database - run
npm start
Check the outputs.
As explained in the comments in test.ts, a portion of the first console.log output that I get is:
organization: { accessUntilExtend: false }
The second console.log that I get is:
organizationDb: { accessUntilExtended: false }
Notice how the property name of accessUntilExtended is misspelled in the first log. I'm not sure what is happening here...
I did the same query using just regular Knex:
node test.js
Wich results in the same:
{ 'paymentProviderCustomerReference.organization.accessUntilExtend': false }
Edit: I've found the culprit. It's not TypedKnex, it's postgres:
NOTICE: identifier "paymentProviderCustomerReference.organization.accessUntilExtended" will be truncated to "paymentProviderCustomerReference.organization.accessUntilExtend"
The same thing happens in Knex.
Do you think you want to fix this problem within TypedKnex, or will you leave it up to the devs to be aware of this postgres behavior?
Look at the typingTest.ts file. If you hover over fullyWrittenSubscription, you'll see the ({}) | null type show up, as expected. The TypedKnex chain here contained a .select().
However, if you hover over shortHandSubscription you'll only see RemoveObjectsFrom<Subscription>. No | null. The TypedKnex chain here did not contain a .select().
Both variables result from a .getSingleOrNull() call.