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

EventGridOutput doesn't contain all types for typescript #177

Closed
kubop opened this issue Oct 23, 2023 · 1 comment · Fixed by #178
Closed

EventGridOutput doesn't contain all types for typescript #177

kubop opened this issue Oct 23, 2023 · 1 comment · Fixed by #178
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kubop
Copy link

kubop commented Oct 23, 2023

One way to define connection to an Event Grid is to use identity based connection, see documentation. However, when dealing with Typescript, the connection property doesn't seem to exist:

Argument of type '{ connection: string; }' is not assignable to parameter of type 'EventGridOutputOptions'.

Sample code:

const eventGridOutput = output.eventGrid({    
    connection: 'EmailServiceTopic'
})

Repro steps

  1. Create a .ts function
  2. Install the latest @azure/functions
  3. Define return function output:
import { app, output } from '@azure/functions';

const eventGridOutput = output.eventGrid({    
    connection: 'EmailServiceTopic'
})

app.serviceBusQueue('ACSEmailMessageQueueTrigger', {
    connection: 'ServiceBusEmailQueue',
    queueName: 'emailservice-queue',
    return: eventGridOutput,
    handler: ....
})

Expected behavior

EventGridOutputOptions type should contain connection property.

Actual behavior

Argument of type '{ connection: string; }' is not assignable to parameter of type 'EventGridOutputOptions'.

Known workarounds

Use Javascript instead of Typescript or suppress TS warnings.

Related information

NodeJS version 18.x
@azure/functions 4.0.1

@ejizba ejizba added the bug Something isn't working label Oct 23, 2023
@ejizba
Copy link
Contributor

ejizba commented Oct 23, 2023

Hi @kubop thanks for the report! In addition to the workarounds you listed, you could use output.generic as discussed here

@ejizba ejizba added this to the Backlog Candidates milestone Oct 23, 2023
@castrodd castrodd self-assigned this Oct 23, 2023
@castrodd castrodd linked a pull request Oct 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants