Skip to content

Property 'body' does not exist on type 'Request' #15199

@devrelm

Description

@devrelm

According to the fetch standard, the Request type should have a body on it, by virtue of it implementing the Body mixin.

Technically, the actual issue here is that the body property on the Response interface should be moved to the Body interface.

TypeScript Version: 2.2.2

Using the es6 lib (though all of the libs with fetch type definitions have this issue.)

Code

// A *self-contained* demonstration of the problem follows...
function getBodyFromRequest(request: Request): ReadableStream | null {
    return request.body;
}

Expected behavior:

Compiles with no errors.

Actual behavior:

Fails with error Property 'body' does not exist on type 'Request'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions