Skip to content

TypeScript errors: Property 'post' does not exist on type 'Agent' #346

@jthemphill

Description

@jthemphill

Upgrading from 4.3.0 to 5.1.1 broke our typechecking. Code like this

chai.request
  .agent(this._server)
  .post('/api/preview')

now fails with this error:

error TS2339: Property 'post' does not exist on type 'Agent'.

We think it's because @types/superagent is now in devDependencies, instead of dependencies. I think it should be in dependencies, because your package exports superagent types publicly. Since the superagent types are part of your public types, any package which uses your types should also include the superagent types that you export.

Originally posted by @jthemphill in #310 (comment)

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