Skip to content

@azure/functions@4.11.1 broken HttpResponseBodyInit typings #409

@sinedied

Description

@sinedied

Just updated from @azure/functions@4.11.0 to @azure/functions@4.11.1 and I get broken builds everywhere in all the samples using HTTP streaming:

src/functions/chats-post.ts:183:7 - error TS2322: Type 'Readable' is not assignable to type 'HttpResponseBodyInit'.
  Type 'Readable' is missing the following properties from type 'FormData': append, set, get, getAll, and 7 more.

183       body: jsonStream,
          ~~~~

  ../../node_modules/@azure/functions/types/http.d.ts:229:5
    229     body?: HttpResponseBodyInit;
            ~~~~
    The expected type comes from property 'body' which is declared here on type 'HttpResponseInit'

The HttpResponseBodyInit was previously defined as any, while on the new version it's:

export type HttpResponseBodyInit =
    | ReadableStream
    | Blob
    | ArrayBufferView
    | ArrayBuffer
    | FormData
    | URLSearchParams
    | string
    | null
    | undefined;

The type aliasing isn't working correctly in this case (not sure why) but this change is breaking many of our samples!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions