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

Property 'default' does not exist on type 'SuperAgentStatic' #98

Open
timmartin opened this issue Oct 9, 2019 · 6 comments
Open

Property 'default' does not exist on type 'SuperAgentStatic' #98

timmartin opened this issue Oct 9, 2019 · 6 comments
Labels

Comments

@timmartin
Copy link

I generated some code, and it fails the Typescript build with

Property 'default' does not exist on type 'SuperAgentStatic'

The code in question is

    const agent = this.configureAgentHandler ?
        this.configureAgentHandler(request.default) :
        request.default;

It seems that the default property doesn't exist according to @types/superagent.

At first glance this issue seems to have been introduced by this change. I can't find a related issue or any other context on that change, but it's clearly a deliberate change that fixed some other problem.

I'm using Superagent v5.1.0 and @types/superagent v4.1.3.

@mtennoe
Copy link
Owner

mtennoe commented Oct 11, 2019

Hm, interesting that the PR to change this had the opposite problem. @Kosta-Github what versions of superagent and @types/superagent were you using when seeing the original issue and creating the fix?

@timmartin - If this is blocking you in some way and you need and urgent workaround until this is resolved, you can copy the class.mustache file, change it and use it as a custom template file

@mtennoe mtennoe added the bug label Oct 14, 2019
@sloan-dog
Copy link

@here This is is still an issue for me.

"@types/superagent": {
  "version": "4.1.7",

"superagent": {
  "version": "3.8.3",

"swagger-typescript-codegen": "^3.0.3",

@mtennoe
Copy link
Owner

mtennoe commented Mar 10, 2020

@sloan-dog - Hm, considering we have seen some inconsistencies in the behavior here, can you try out what happens if you downgrade the version of @types/superagent? If it works in an older version, seems like we in this change broke it for newer versions. In that case we should support the newer version of it imo.

Does it work if you disable typings with an "as any" cast btw? If so, it might be a bug in @types/superagent itself

@tgilland95
Copy link

@here I've had this issue before and for me what resolves it is adjusting compiler options in the tsconfig. This may not solve it for everyone, but adding
"esModuleInterop": true fixes my error.

@bitsofinfo
Copy link

same issue, any updates?

@mtennoe
Copy link
Owner

mtennoe commented Sep 23, 2020

No updates from my side sadly. Have you tried what tgilland95 suggested above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants