Giter Club home page Giter Club logo

Comments (11)

Murderlon avatar Murderlon commented on June 2, 2024

Hi, we can change it to simply string. For now you can use @ts-expect-error to silence it.

from uppy.

Murderlon avatar Murderlon commented on June 2, 2024

BTW unless you are on the 4.0 beta version, you should still have the old types:

method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'get' | 'post' | 'put' | 'head'

Are you on the beta version?

from uppy.

pedantic-git avatar pedantic-git commented on June 2, 2024

Hi @Murderlon - thanks for your quick reply!

I am on the latest released version so it probably is the list of types you indicate here, but that list still doesn't include PATCH.

Can I use @ts-expect-error in my code that calls this? My code is JS and not TS so I'm not sure how to add this line - is it in a comment somewhere?

from uppy.

Murderlon avatar Murderlon commented on June 2, 2024

If you're not using TS, it doesn't matter to you what the types are, you wouldn't get an error regardless of what you pass. What error are you seeing then?

from uppy.

pedantic-git avatar pedantic-git commented on June 2, 2024

@Murderlon There's no error - the HTTP request gets initiated but with no method set at all, which causes the server to complain that it's received a malformed request.

But in trying to get you screenshots I've now discovered that the TS version works up to version 3.6.4 so I guess it's not TS that's the problem but some other underlying cause. Here's what the request looks like using version 3.6.4:

Screenshot from 2024-05-15 13-52-23

and here's what it looks like when using 3.6.5/3.6.6 (I changed no other packages in package.json except @uppy/xhr-upload):

Screenshot from 2024-05-15 13-53-06

from uppy.

Murderlon avatar Murderlon commented on June 2, 2024

That looks like a regression indeed. I can take a look.

from uppy.

pedantic-git avatar pedantic-git commented on June 2, 2024

Thanks so much! A couple more datapoints from my investigation if they're helpful:

  • #5074 looks like the main change between those two versions
  • Even at 3.6.5, if I set the method to 'post' it does generate the request correctly (it's just the wrong request because I need 'patch' 😄 )

from uppy.

pedantic-git avatar pedantic-git commented on June 2, 2024

Furthermore, I've discovered that if I name the method 'PATCH' in capitals, it works! 🎉 So maybe it's only the documentation that needs updating, as well as presumably a version bump to warn people that there's a breaking change (since it used to support lowercase).

from uppy.

Murderlon avatar Murderlon commented on June 2, 2024

I was just going to say I can confirm with a test that it works. PR welcome to update types & docs :)

from uppy.

pedantic-git avatar pedantic-git commented on June 2, 2024

Thanks! I don't know enough about TS to make a change to the types in the code but happy to submit a PR to update the docs.

from uppy.

aduh95 avatar aduh95 commented on June 2, 2024

IMO we should fix the regression.

from uppy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.