Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper types for HandlerFunctions #370

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

daogrady
Copy link
Contributor

@daogrady daogrady commented Dec 10, 2024

Fixes cap-js/cds-typer#423

sample use:

import { HandlerFunction } from '@cap-js/cds-types'
import { myAction } from '#cds-models/…'

// …

srv.on(myAction, onMyAction)

function onMyAction (req: HandlerFunction<typeof myAction>['parameters']['req']: HandlerFunction<typeof myAction>['returns']> {

// or

type ActionType = HandlerFunction<typeof myAction>

function onMyAction2 (req: ActionType['parameters']['req']): ActionType['returns']

  // …
}

@daogrady daogrady marked this pull request as ready for review December 12, 2024 07:11
@daogrady daogrady requested a review from chgeo December 12, 2024 07:11
apis/services.d.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[QUESTION] How to type non lambda actions/functions
2 participants