apify / got-scraping

HTTP client made for scraping based on got.
422 stars 32 forks source link

A request to bump up got version #94

Closed JaneJeon closed 11 months ago

JaneJeon commented 1 year ago

Hi, just wanted to check if you could cut a release w/ got v13 (I understand you guys create a got-cjs cut of the original library, and that, too, doesn't have a version w/ got v13 yet).

Basically, I have a couple of got libraries based off of got v13 and there's a bit of type error when you try to "mix" got v13 with got-scraping (based on got v12):

src/index.ts(7,23): error TS2345: Argument of type 'Got' is not assignable to parameter of type 'ExtendOptions | Got'.
  Type 'import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got/dist/source/types", { assert: { "resolution-mode": "import" } }).Got' is not assignable to type 'import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got-cjs/dist/source/types").Got'.
    Type 'Got' is not assignable to type '{ stream: GotStream; paginate: GotPaginate; defaults: InstanceDefaults; extend: (...instancesOrOptions: (ExtendOptions | Got)[]) => Got; }'.
      Types of property 'stream' are incompatible.
        Type 'import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got/dist/source/types", { assert: { "resolution-mode": "import" } }).GotStream' is not assignable to type 'import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got-cjs/dist/source/types").GotStream'.
          Type 'GotStream' is not assignable to type '(url?: string | URL | undefined, options?: Merge<OptionsInit, { isStream?: true; }> | undefined) => Request'.
            Types of parameters 'options' and 'options' are incompatible.
              Type 'Merge<import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got-cjs/dist/source/core/options").OptionsInit, { isStream?: true; }> | undefined' is not assignable to type 'Merge<import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got/dist/source/core/options", { assert: { "resolution-mode": "import" } }).OptionsInit, { isStream?: true; }> | undefined'.
                Type 'Merge<OptionsInit, { isStream?: true; }>' is not assignable to type 'Merge<OptionsInit, { isStream?: true; }> | undefined'.
                  Type 'Merge<import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got-cjs/dist/source/core/options").OptionsInit, { isStream?: true; }>' is not assignable to type 'Merge<import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got/dist/source/core/options", { assert: { "resolution-mode": "import" } }).OptionsInit, { isStream?: true; }>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                    Type 'Merge<OptionsInit, { isStream?: true; }>' is not assignable to type 'Except<OptionsInit, "isStream">' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
                      The types of 'retry.calculateDelay' are incompatible between these types.
                        Type 'import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got-cjs/dist/source/core/options").RetryFunction' is not assignable to type 'import("/Users/janejeon/Projects/@janejeon/dev/node_modules/got/dist/source/core/options", { assert: { "resolution-mode": "import" } }).RetryFunction'.

I'm not sure how "serious" it is, but given that it's just the retry options being different, I don't reckon it will be a huge deal, but would be nice to have a v13 to go off of to resolve this without @ts-expect-error nonetheless.

Thank you :)

B4nan commented 11 months ago

I will close this in favor of #56 as the update is tied to the ESM-only release.