cap-js / cds-typer

CDS type generator for JavaScript
Apache License 2.0
29 stars 10 forks source link

Safely override `.kind` and `Buffer` improvements #367

Closed daogrady closed 1 month ago

daogrady commented 1 month ago

Only add override modifier to kind property iff any parent class actually has such a property to override. This change is implicitly tested by having added strict: true to the transpilation tests in tscheck.js. Fixes https://github.com/cap-js/cds-typer/issues/273

Generally, the creation of class members has been streamlined to avoid typos and incorrect order/ combination of modifiers via lib/components.class::createMember instead of concatenating strings manually.

Also streamlined use of Buffer.add to accept scalar strings, array of strings, and functions returning strings, to enable buffer.add(xs) over xs.forEach(x => buffer.add(x)). Also added buffer.blankLine() to replace the somewhat obscure buffer.add('')