Skip to content

Commit f4b01d7

Browse files
authored
fix: verbatimModuleSyntax (#953)
1 parent 833d172 commit f4b01d7

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

src/layers/2_generator/__snapshots__/files.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export const isError = <$Value>(value: $Value): value is Include<$Value, ErrorOb
4343
`;
4444
4545
exports[`schema2 5`] = `
46-
"import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
47-
import { Index } from './Index.js'
46+
"import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
47+
import type { Index } from './Index.js'
4848
4949
// Runtime
5050
// -------

src/layers/2_generator/code/Error.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ export const { generate: generateError, moduleName: moduleNameError } = createCo
1111
)
1212

1313
code.push(`
14-
const ErrorObjectsTypeNameSelectedEnum = {
15-
${config.error.objects.map(_ => `${_.name}: { __typename: '${_.name}' }`).join(`,\n`)}
16-
} as ${config.error.objects.length > 0 ? `const` : `Record<string,ObjectWithTypeName>`}
14+
const ErrorObjectsTypeNameSelectedEnum = {
15+
${config.error.objects.map(_ => `${_.name}: { __typename: '${_.name}' }`).join(`,\n`)}
16+
} as ${config.error.objects.length > 0 ? `const` : `Record<string,ObjectWithTypeName>`}
1717
18-
const ErrorObjectsTypeNameSelected = Object.values(ErrorObjectsTypeNameSelectedEnum)
18+
const ErrorObjectsTypeNameSelected = Object.values(ErrorObjectsTypeNameSelectedEnum)
1919
20-
type ErrorObjectsTypeNameSelected = (typeof ErrorObjectsTypeNameSelected)[number]
21-
`)
20+
type ErrorObjectsTypeNameSelected = (typeof ErrorObjectsTypeNameSelected)[number]
21+
`)
2222

2323
code.push(
2424
`export const isError = <$Value>(value:$Value): value is Include<$Value, ErrorObjectsTypeNameSelected> => {

src/layers/2_generator/code/Select.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export const { generate: generateSelect, moduleName: moduleNameSelect } = create
77
(config) => {
88
const code: string[] = []
99

10-
code.push(`import { Index } from './${moduleNameIndex}.js'`)
11-
code.push(`import { SelectionSet, ResultSet } from '${config.libraryPaths.schema}'`)
10+
code.push(`import type { Index } from './${moduleNameIndex}.js'`)
11+
code.push(`import type { SelectionSet, ResultSet } from '${config.libraryPaths.schema}'`)
1212
code.push(``)
1313

1414
code.push(

src/layers/2_generator/code/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const { moduleName: moduleNameGlobal, generate: generateGlobal } = create
1111
const code: string[] = []
1212

1313
code.push(
14-
`import { Index } from './${moduleNameIndex}.js'`,
14+
`import type { Index } from './${moduleNameIndex}.js'`,
1515
)
1616

1717
if (config.typeMapByKind.GraphQLScalarTypeCustom.length > 0) {

tests/_/schema/generated/Global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Index } from './Index.js'
1+
import type { Index } from './Index.js'
22

33
import type * as CustomScalar from '../../customScalarCodecs.js'
44

tests/_/schema/generated/Select.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
2-
import { Index } from './Index.js'
1+
import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
2+
import type { Index } from './Index.js'
33

44
// Runtime
55
// -------

tests/_/schemaMutationOnly/generated/Global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Index } from './Index.js'
1+
import type { Index } from './Index.js'
22

33
declare global {
44
export namespace GraphQLRequestTypes {

tests/_/schemaMutationOnly/generated/Select.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
2-
import { Index } from './Index.js'
1+
import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
2+
import type { Index } from './Index.js'
33

44
// Runtime
55
// -------

tests/_/schemaQueryOnly/generated/Global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Index } from './Index.js'
1+
import type { Index } from './Index.js'
22

33
declare global {
44
export namespace GraphQLRequestTypes {

tests/_/schemaQueryOnly/generated/Select.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
2-
import { Index } from './Index.js'
1+
import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
2+
import type { Index } from './Index.js'
33

44
// Runtime
55
// -------

0 commit comments

Comments
 (0)