Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/loose-carrots-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@eddeee888/gcg-operation-location-migration': minor
'@eddeee888/gcg-typescript-resolver-files': minor
---

Bump ts-morph to ^28.0.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"nx": "23.1.1",
"prettier": "^2.6.2",
"rimraf": "6.1.3",
"ts-morph": "22.0.0",
"ts-morph": "28.0.0",
"tsx": "4.23.1",
"typescript": "6.0.3",
"typescript-eslint": "8.67.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/operation-location-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@graphql-codegen/add": "^7.1.0",
"@graphql-codegen/plugin-helpers": "^7.1.0",
"change-case-all": "^1.0.0",
"ts-morph": "^22.0.0",
"ts-morph": "^28.0.0",
"tslib": "^2.3.0"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-resolver-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@graphql-tools/merge": "^9.2.2",
"@graphql-tools/utils": "^11.2.2",
"micromatch": "^4.0.0",
"ts-morph": "^22.0.0",
"ts-morph": "^28.0.0",
"tslib": "^2.8.0"
},
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ const mustGetMapperOriginalDeclarationNode = ({
}
}

if (identifierNode && !Node.isIdentifier(identifierNode)) {
// A string-literal export name can never reference a valid TS type,
// so it can't be a type mapper.
continue;
}

if (identifierNode?.getText() === mapper.name) {
return {
declarationNode: descendant,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import { type SourceFile, type Identifier, SyntaxKind } from 'ts-morph';
import { type SourceFile, type Identifier, Node, SyntaxKind } from 'ts-morph';
import {
normalizeRelativePath,
normalizeImportExtension,
Expand Down Expand Up @@ -78,6 +78,12 @@ export const collectTypeMappersFromSourceFile = (
identifierNode = aliasNode;
}

if (!Node.isIdentifier(identifierNode)) {
// A string-literal export name (e.g. `export { Foo as "not-an-identifier" }`)
// can never reference a valid TS type, so it can't be a type mapper.
return;
}

addTypeMapperDetailsIfValid(
{
kind: SyntaxKind.ExportSpecifier,
Expand Down
38 changes: 15 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.