reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.59k stars 1.14k forks source link

rtk-query-codegen-openapi has stopped working. #3765

Open kahirokunn opened 10 months ago

kahirokunn commented 10 months ago

I ran test with the following command and got an error. 😢 I tried yarn versions 2~4, but I couldn't figure it out. Do you know what could be the cause? I'm not sure when I last ran it, but I think it happened after rm -rf node_modules and then yarn install again. 😭

$ cd redux-toolkit/packages/rtk-query-codegen-openapi
$ yarn install
$ yarn test
 FAIL  test/cli.test.ts (8.155 s)
  ● CLI options testing › generation with `config.example.js`

    expect(received).toEqual(expected) // deep equality

    - Expected  -  3
    + Received  + 21

      Object {
    -   "error": null,
    -   "stderr": "",
    +   "error": Error {
    +     "cmd": "/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/node_modules/ts-node/dist/bin.js -T -P /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/tsconfig.json /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/bin/cli.ts ./config.example.js",
    +     "code": 1,
    +     "killed": false,
    +     "signal": null,
    +   },
    +   "stderr": "DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
    + DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.8.0. Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter.
    + DeprecationWarning: 'createIndexSignature' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
    + TypeError: Cannot read properties of undefined (reading 'length')
    +     at emitUnparsedSourceOrPrepend (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90429:61)
    +     at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90150:24)
    +     at pipelineEmitWithHint (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89898:13)
    +     at pipelineEmitWithComments (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:93061:11)
    +     at pipelineEmit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89847:11)
    +     at emit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89820:11)
    +     at emitNodeList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92443:17)
    +     at emitList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92349:11)
    +     at emitObjectLiteralExpression (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90863:11)
    +     at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90254:24)
    + ",
        "stdout": "Generating ./tmp/example.ts
    - Done
      ",
      }

      36 |     const out = await cli([`./config.example.js`], __dirname);
      37 |
    > 38 |     expect(out).toEqual({
         |                 ^
      39 |       stdout: `Generating ./tmp/example.ts
      40 | Done
      41 | `,

      at Object.<anonymous> (cli.test.ts:38:17)

  ● CLI options testing › paths are relative to configfile, not to cwd

    expect(received).toEqual(expected) // deep equality

    - Expected  -  3
    + Received  + 21

      Object {
    -   "error": null,
    -   "stderr": "",
    +   "error": Error {
    +     "cmd": "/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/node_modules/ts-node/dist/bin.js -T -P /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/tsconfig.json /Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/bin/cli.ts ../test/config.example.js",
    +     "code": 1,
    +     "killed": false,
    +     "signal": null,
    +   },
    +   "stderr": "DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
    + DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.8.0. Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter.
    + DeprecationWarning: 'createIndexSignature' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.
    + TypeError: Cannot read properties of undefined (reading 'length')
    +     at emitUnparsedSourceOrPrepend (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90429:61)
    +     at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90150:24)
    +     at pipelineEmitWithHint (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89898:13)
    +     at pipelineEmitWithComments (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:93061:11)
    +     at pipelineEmit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89847:11)
    +     at emit (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:89820:11)
    +     at emitNodeList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92443:17)
    +     at emitList (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:92349:11)
    +     at emitObjectLiteralExpression (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90863:11)
    +     at pipelineEmitWithHintWorker (/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/src/generate.ts:90254:24)
    + ",
        "stdout": "Generating ./tmp/example.ts
    - Done
      ",
      }

      50 |     const out = await cli([`../test/config.example.js`], path.resolve(__dirname, '../src'));
      51 |
    > 52 |     expect(out).toEqual({
         |                 ^
      53 |       stdout: `Generating ./tmp/example.ts
      54 | Done
      55 | `,

      at Object.<anonymous> (cli.test.ts:52:17)

  ● CLI options testing › ts, js and json all work the same

    ENOENT: no such file or directory, open '/Users/kahiro/Documents/redux-toolkit/packages/rtk-query-codegen-openapi/test/tmp/example.ts'

      63 |   test('ts, js and json all work the same', async () => {
      64 |     await cli([`./config.example.js`], __dirname);
    > 65 |     const fromJs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8');
         |                       ^
      66 |     await cli([`./config.example.ts`], __dirname);
      67 |     const fromTs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8');
      68 |     await cli([`./config.example.json`], __dirname);

      at Object.<anonymous> (cli.test.ts:65:23)

 FAIL  test/generateEndpoints.test.ts
  ● Console

    console.warn
      DeprecationWarning: 'createTypeAliasDeclaration' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.

      222 |               code,
      223 |               apiGen.resolve(response),
    > 224 |               apiGen.getTypeFromResponse(response) || factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
          |                      ^
      225 |             ] as const
      226 |         )
      227 |         .filter(([status, response]) => isDataResponse(status, apiGen.resolve(response), responses || {}))

      at Object.log (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:174493:62)
      at logMessage (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2502:35)
      at Function.warn (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2515:17)
      at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3116:25
      at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3137:17
      at Object.createTypeAliasDeclaration (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:172142:27)
      at Object.createTypeAliasDeclaration (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:75:18)
      at ApiGenerator.getRefAlias (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:261:12)
      at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:361:19)
      at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
      at ../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:446:23
          at Array.map (<anonymous>)
      at ApiGenerator.getTypeFromProperties (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:443:58)
      at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:394:19)
      at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
      at ApiGenerator.getRefAlias (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:259:25)
      at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:361:19)
      at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
      at ApiGenerator.getTypeFromResponse (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:501:17)
      at map (../src/generate.ts:224:22)
          at Array.map (<anonymous>)
      at generateEndpoint (../src/generate.ts:219:10)
      at map (../src/generate.ts:144:15)
          at Array.map (<anonymous>)
      at generateApi (../src/generate.ts:143:34)
      at generateEndpoints (../src/index.ts:14:22)
      at Object.<anonymous> (generateEndpoints.test.ts:18:15)

    console.warn
      DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.8.0. Decorators have been combined with modifiers. Callers should switch to an overload that does not accept a 'decorators' parameter.

      222 |               code,
      223 |               apiGen.resolve(response),
    > 224 |               apiGen.getTypeFromResponse(response) || factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
          |                      ^
      225 |             ] as const
      226 |         )
      227 |         .filter(([status, response]) => isDataResponse(status, apiGen.resolve(response), responses || {}))

      at Object.log (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:174493:62)
      at logMessage (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2502:35)
      at Function.warn (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2515:17)
      at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3116:25
      at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3137:17
      at Object.createParameterDeclaration (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:172142:27)
      at createParameter (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:295:18)
      at Object.createIndexSignature (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:351:6)
      at ApiGenerator.getTypeFromProperties (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:462:23)
      at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:394:19)
      at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
      at ApiGenerator.getTypeFromResponse (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:501:17)
      at map (../src/generate.ts:224:22)
          at Array.map (<anonymous>)
      at generateEndpoint (../src/generate.ts:219:10)
      at map (../src/generate.ts:144:15)
          at Array.map (<anonymous>)
      at generateApi (../src/generate.ts:143:34)
      at generateEndpoints (../src/index.ts:14:22)
      at Object.<anonymous> (generateEndpoints.test.ts:18:15)

    console.warn
      DeprecationWarning: 'createIndexSignature' has been deprecated since v4.8.0. Decorators are no longer supported for this function. Callers should switch to an overload that does not accept a 'decorators' parameter.

      222 |               code,
      223 |               apiGen.resolve(response),
    > 224 |               apiGen.getTypeFromResponse(response) || factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
          |                      ^
      225 |             ] as const
      226 |         )
      227 |         .filter(([status, response]) => isDataResponse(status, apiGen.resolve(response), responses || {}))

      at Object.log (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:174493:62)
      at logMessage (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2502:35)
      at Function.warn (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:2515:17)
      at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3116:25
      at ../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:3137:17
      at Object.createIndexSignature (../node_modules/@rtk-query/oazapfts-patched/node_modules/typescript/lib/typescript.js:172142:27)
      at Object.createIndexSignature (../node_modules/@rtk-query/oazapfts-patched/src/codegen/tscodegen.ts:348:18)
      at ApiGenerator.getTypeFromProperties (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:462:23)
      at ApiGenerator.getBaseTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:394:19)
      at ApiGenerator.getTypeFromSchema (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:346:23)
      at ApiGenerator.getTypeFromResponse (../node_modules/@rtk-query/oazapfts-patched/src/codegen/generate.ts:501:17)
      at map (../src/generate.ts:224:22)
          at Array.map (<anonymous>)
      at generateEndpoint (../src/generate.ts:219:10)
      at map (../src/generate.ts:144:15)
          at Array.map (<anonymous>)
      at generateApi (../src/generate.ts:143:34)
      at generateEndpoints (../src/index.ts:14:22)
      at Object.<anonymous> (generateEndpoints.test.ts:18:15)

  ● calling without `outputFile` returns the generated api

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● endpoint filtering

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● endpoint filtering by function

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● negated endpoint filtering

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● endpoint overrides

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● option flattenArg › should apply a queryArg directly in the path

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● option flattenArg › should apply a queryArg directly in the params

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● option flattenArg › should use the queryArg as the entire body

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● option flattenArg › should not change anything if there are 2+ arguments.

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● hooks generation

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● supports granular hooks generation that includes all query types

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● supports granular hooks generation with only queries

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● supports granular hooks generation with only lazy queries

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● supports granular hooks generation with only mutations

    TypeError: Cannot read properties of undefined (reading 'end')

      at emitCaseBlock (../node_modules/typescript/lib/typescript.js:110393:73)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108781:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitSourceFileWorker (../node_modules/typescript/lib/typescript.js:110996:13)
      at emitBodyWithDetachedComments (../node_modules/typescript/lib/typescript.js:112256:17)

  ● hooks generation uses overrides

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● should use brackets in a querystring urls arg, when the arg contains full stops

    expect(received).toMatchSnapshot()

    Snapshot name: `should use brackets in a querystring urls arg, when the arg contains full stops 1`

    - Snapshot  - 2
    + Received  + 2

    @@ -9,10 +9,10 @@
          }),
        }),
        overrideExisting: false,
      });
      export { injectedRtkApi as enhancedApi };
    - export type PatchApiV1ListByItemIdApiResponse = /** status 200 A successful response. */ string;
    + export type PatchApiV1ListByItemIdApiResponse = /** status 200 A successful response. */ undefined;
      export type PatchApiV1ListByItemIdApiArg = {
    -   'item.id': string;
    +   'item.id': undefined;
      };
      ↵

      227 |   // eslint-disable-next-line no-template-curly-in-string
      228 |   expect(api).toContain('`/api/v1/list/${queryArg["item.id"]}`');
    > 229 |   expect(api).toMatchSnapshot();
          |               ^
      230 | });
      231 |
      232 | test('apiImport builds correct `import` statement', async () => {

      at Object.<anonymous> (generateEndpoints.test.ts:229:15)

  ● yaml parsing › should parse a yaml schema from a URL

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● yaml parsing › should be able to use read a yaml file

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● yaml parsing › should generate params with non quoted keys if they don't contain special characters

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● yaml parsing › should generate params with quoted keys if they contain special characters

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

  ● tests from issues › issue #2002: should be able to generate proper intersection types

    TypeError: Cannot read properties of undefined (reading 'length')

      at emitUnparsedSourceOrPrepend (../node_modules/typescript/lib/typescript.js:109172:59)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108856:32)
      at pipelineEmitWithHint (../node_modules/typescript/lib/typescript.js:108586:17)
      at pipelineEmitWithComments (../node_modules/typescript/lib/typescript.js:112140:13)
      at pipelineEmit (../node_modules/typescript/lib/typescript.js:108526:13)
      at emit (../node_modules/typescript/lib/typescript.js:108499:13)
      at emitNodeList (../node_modules/typescript/lib/typescript.js:111378:25)
      at emitList (../node_modules/typescript/lib/typescript.js:111265:13)
      at emitObjectLiteralExpression (../node_modules/typescript/lib/typescript.js:109645:13)
      at pipelineEmitWithHintWorker (../node_modules/typescript/lib/typescript.js:108970:32)

 › 1 snapshot failed.
 › 4 snapshots obsolete.
   • endpoint filtering: should only have endpoints loginUser, placeOrder, getOrderById, deleteOrder 1
   • endpoint overrides: loginUser should be a mutation 1
   • hooks generation uses overrides: should generate an `useLoginMutation` mutation hook 1
   • hooks generation: should generate an `useGetPetByIdQuery` query hook and an `useAddPetMutation` mutation hook 1
Snapshot Summary
 › 1 snapshot failed from 1 test suite. Inspect your code changes or re-run jest with `-u` to update them.
 › 4 snapshots obsolete from 1 test suite. To remove them all, re-run jest with `-u`.
   ↳ ./generateEndpoints.test.ts
       • endpoint filtering: should only have endpoints loginUser, placeOrder, getOrderById, deleteOrder 1
       • endpoint overrides: loginUser should be a mutation 1
       • hooks generation uses overrides: should generate an `useLoginMutation` mutation hook 1
       • hooks generation: should generate an `useGetPetByIdQuery` query hook and an `useAddPetMutation` mutation hook 1

Test Suites: 2 failed, 2 total
Tests:       24 failed, 4 passed, 28 total
Snapshots:   1 failed, 4 obsolete, 1 total
Time:        9.232 s
Ran all test suites.
$ git log
commit 52ab548c55198f2c5cacb2be9a8dbae235d4443c (HEAD -> master, origin/master, origin/HEAD, k8s-client-api-test)
Merge: e351a09a 0d054809
Author: Mark Erikson <mark@isquaredsoftware.com>
Date:   Wed Sep 27 23:46:06 2023 -0400

    Merge pull request #3754 from jgabuya/patch-1
$ yarn tsc -v
Version 4.5.5
kahirokunn commented 10 months ago

https://github.com/reduxjs/redux-toolkit/pull/3771

The reason for this is that codegen's TypeScript version was 4.5, but oazapfts' TypeScript version was 4.9.2, which broke compatibility.

To fix this problem, it would be best to use the resolution field and fix the oazapfts TypeScript version to the user's TypeScript version.