cds-typer icon indicating copy to clipboard operation
cds-typer copied to clipboard

[BUG] Issue with Inline Defined Types

Open tsteckenborn opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Nature of Your Project

TypeScript

Current Behavior

Given an inline defined type, such as:

context: {
title: String;
content: String;
};

Using it within QL based on it's types, it's typed as:

context?: QLExtensions_<{title?: string | null; content?: string | null }>  | undefined

Leading to implied usage as:

[...]?.context?.content

Yet that leads to a tried access on a column named CONTENT.

Correct usage here would be:

[...]?.context_content

This works, but yields a type error.

Expected Behavior

Return a correct type for usage within QL also for inline defined types.

Steps To Reproduce

No response

Environment

- **OS**: Mac OS
- **Node**: v20.10.0
- **npm**: 10.2.3
- **cds-typer**: 0.12.0
- **cds**: 7.4.1

Repository Containing a Minimal Reproducible Example

No response

Anything else?

No response

tsteckenborn avatar Jan 24 '24 16:01 tsteckenborn