Skip to content

Commit ae6c9fb

Browse files
authored
[EdgeDB] Removed upstreamed change to generation (#3059)
1 parent f583dfc commit ae6c9fb

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

src/core/edgedb/generator/query-builder.ts

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { generateQueryBuilder as runQueryBuilderGenerator } from '@edgedb/generate/dist/edgeql-js.js';
22
import { groupBy } from '@seedcompany/common';
3-
import { Directory, SyntaxKind } from 'ts-morph';
3+
import { Directory } from 'ts-morph';
44
import { customScalars } from './scalars';
55
import { addCustomScalarImports, GeneratorParams } from './util';
66

@@ -27,7 +27,6 @@ export async function generateQueryBuilder({
2727
updateCastMapsForOurCustomScalars(qbDir);
2828
changeImplicitIDType(qbDir);
2929
allowOrderingByEnums(qbDir);
30-
mergeDefaultTypesWithModuleNames(qbDir);
3130
}
3231

3332
function addJsExtensionDeepPathsOfEdgedbLibrary(qbDir: Directory) {
@@ -118,29 +117,3 @@ function allowOrderingByEnums(qbDir: Directory) {
118117
.setType('TypeSet<EnumType | ScalarType | ObjectType>');
119118
file.fixMissingImports();
120119
}
121-
122-
function mergeDefaultTypesWithModuleNames(qbDir: Directory) {
123-
const file = qbDir.getSourceFileOrThrow('index.ts');
124-
const st = file.getVariableDeclarationOrThrow('ExportDefault');
125-
const typeText = st.getTypeNodeOrThrow().getFullText();
126-
const value = st.getInitializerIfKindOrThrow(
127-
SyntaxKind.ObjectLiteralExpression,
128-
);
129-
// Regex is faster here than ts-morph type parsing
130-
const conflicting = (
131-
typeText.match(/Omit<typeof _default, (.+)>/)?.[1].split(/ \| /g) ?? []
132-
).map((s) => s.slice(1, -1));
133-
let newTypeText = typeText;
134-
for (const name of conflicting) {
135-
newTypeText = newTypeText.replace(
136-
`typeof _${name}`,
137-
`typeof _${name} & typeof _default.${name}`,
138-
);
139-
value
140-
.getPropertyOrThrow(`"${name}"`)
141-
.asKindOrThrow(SyntaxKind.PropertyAssignment)
142-
.getInitializerOrThrow()
143-
.replaceWithText(`{ ..._${name}, ..._default.${name} }`);
144-
}
145-
st.setType(newTypeText);
146-
}

0 commit comments

Comments
 (0)