TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Trying to call .addTypeArguments() on a ExpressionWithTypeArguments that contains a mixin results in an exception: ```yaml /Users/mak13180/site/esri/arcgis-web-components-3/node_modules/@ts-morph/common/dist/ts-morph-common.js:438 throw new InvalidOperationError(typeof errorMessage === "string" ? errorMessage : errorMessage(), node); ^ InvalidOperationError: A child of the kind Identifier was expected. /Users/mak13180/site/esri/arcgis-web-components-3/packages/support-packages/jsapi-extractor/test.ts:1:17 > 1 | class A extends B(C) {} at Object.throwIfNullOrUndefined (/Users/mak13180/site/esri/arcgis-web-components-3/node_modules/@ts-morph/common/dist/ts-morph-common.js:438:19) at ExpressionWithTypeArguments.getFirstChildByKindOrThrow (/Users/mak13180/site/esri/arcgis-web-components-3/node_modules/ts-morph/dist/ts-morph.js:3857:30) at ExpressionWithTypeArguments.insertTypeArguments (/Users/mak13180/site/esri/arcgis-web-components-3/node_modules/ts-morph/dist/ts-morph.js:10126:41) at ExpressionWithTypeArguments.addTypeArguments (/Users/mak13180/site/esri/arcgis-web-components-3/node_modules/ts-morph/dist/ts-morph.js:10115:25) at <anonymous> (/Users/mak13180/site/esri/arcgis-web-components-3/packages/support-packages/jsapi-extractor/src/temp.ts:11:14) at ModuleJob.run (node:internal/modules/esm/module_job:271:25) at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) Node.js v22.12.0 ``` Version: 25.0.1 **To Reproduce** ```ts import { Project, SyntaxKind } from "ts-morph"; const project = new Project(); const sourceFile = project.createSourceFile("test.ts", "class A extends B(C) {}"); const expression = sourceFile.getFirstDescendantByKindOrThrow(SyntaxKind.ExpressionWithTypeArguments); expression.addTypeArguments(["D"]); ``` **Expected behavior** No exception should occur. Source file should be modified to look as follows: ```ts class A extends B(C)<D> {} ``` **Workaround** Use .replaceText(): ```ts expression.replaceWithText(`${expression.getText()}<D>`); ``` **Extra details** Bug occurs here: https://github.com/dsherret/ts-morph/blob/a1c61c7e04928de5d8fc12f32a76e3ed5b7ffea1/packages/ts-morph/src/compiler/ast/base/TypeArgumentedNode.ts#L89 Code should be modified to handle the case that TypeArgumentedNode contains something other than identifier
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by maxpatiiuk and has received 0 comments.