@cap-js/cds-typer 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/lib/visitor.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
|
|
|
6
6
|
|
|
7
7
|
## Version 0.21.0 - TBD
|
|
8
8
|
|
|
9
|
+
## Version 0.20.1 - 2024-04-24
|
|
10
|
+
### Fixed
|
|
11
|
+
- Void actions no longer crash the type generation process
|
|
12
|
+
|
|
9
13
|
## Version 0.20.0 - 2024-04-23
|
|
10
14
|
### Added
|
|
11
15
|
- Types for actions and functions now expose a `.kind` property which holds the string `'function'` or `'action'` respectively
|
package/lib/visitor.js
CHANGED
|
@@ -363,12 +363,13 @@ class Visitor {
|
|
|
363
363
|
* @param {'function' | 'action'} kind
|
|
364
364
|
*/
|
|
365
365
|
#printOperation(name, operation, kind) {
|
|
366
|
-
// FIXME: mostly duplicate of printAction -> reuse
|
|
367
366
|
this.logger.debug(`Printing operation ${name}:\n${JSON.stringify(operation, null, 2)}`)
|
|
368
367
|
const ns = this.resolver.resolveNamespace(name.split('.'))
|
|
369
368
|
const file = this.fileRepository.getNamespaceFile(ns)
|
|
370
369
|
const params = this.#stringifyFunctionParams(operation.params, file)
|
|
371
|
-
const returnType =
|
|
370
|
+
const returnType = operation.returns
|
|
371
|
+
? this.resolver.resolveAndRequire(operation.returns, file)
|
|
372
|
+
: { typeName: 'void', typeInfo: { isArray: false, inflection: { singular: 'void', plural: 'void' } } }
|
|
372
373
|
const returns = this.inlineDeclarationResolver.getPropertyDatatype(
|
|
373
374
|
returnType,
|
|
374
375
|
returnType.typeInfo.isArray ? returnType.typeName : returnType.typeInfo.inflection.singular
|