From 03ccd1ef4ce751847e7ecb30c9544c8c257e44c5 Mon Sep 17 00:00:00 2001 From: Johannes Vogel <31311694+johannes-vogel@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:59:52 +0100 Subject: [PATCH] [parked] fix: types of QL return (#10) * add test to reproduce problem * Introduce `UnionToIntersection` (#22) * Introduce UnionToIntersection * Add changelog entry * Fix trailing spaces * Changelog for `SELECT.from.ref` --------- Co-authored-by: Daniel O'Grady <103028279+daogrady@users.noreply.github.com> Co-authored-by: Christian Georgi Co-authored-by: Christian Georgi --- CHANGELOG.md | 7 +++++- apis/cqn.d.ts | 7 +++--- apis/internal/inference.d.ts | 34 ++++++++++++++++++++++++++ test/typescript/apis/project/cds-ql.ts | 7 ++++++ 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0253314..6fe8f1e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). - Type for special error listener `srv.on('error')` +### Changed + +- `source`, `column_expr`, and `predicate` have been converted to partial intersection types. This offers all possible optional properties. You will have to make sure to check their presence when accessing them + ### Fixed - `srv.send` overload to also allow optional headers @@ -17,13 +21,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). - `cds.builtin.types` got a more accurate type - The `LinkedEntity.drafts` property is now optional. At runtime, it's only set for drafted entities. - `cds.model` is marked as modifiable (for tests only!) +- `SELECT.from` got its `ref` property back ## Version 0.1.0 - 2023-12-13 ### Changed -- Rework of the export structure of the main `cds` facade object, so that e.g. `cds.Request` and `cds.User` work again. +- Rework of the export structure of the main `cds` facade object, so that e.g. `cds.Request` and `cds.User` work again ### Fixed diff --git a/apis/cqn.d.ts b/apis/cqn.d.ts index 539d355f..35bec7e5 100644 --- a/apis/cqn.d.ts +++ b/apis/cqn.d.ts @@ -1,4 +1,5 @@ import { entity } from './csn' // cyclic dependency +import { UnionToIntersection, UnionsToIntersections } from './internal/inference' // FIXME: a union type would be more appropriate here export type Query = Partial