Skip to content

Commit

Permalink
fix: verbatimModuleSyntax (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Jul 1, 2024
1 parent 833d172 commit f4b01d7
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/layers/2_generator/__snapshots__/files.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export const isError = <$Value>(value: $Value): value is Include<$Value, ErrorOb
`;
exports[`schema2 5`] = `
"import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import { Index } from './Index.js'
"import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import type { Index } from './Index.js'
// Runtime
// -------
Expand Down
12 changes: 6 additions & 6 deletions src/layers/2_generator/code/Error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export const { generate: generateError, moduleName: moduleNameError } = createCo
)

code.push(`
const ErrorObjectsTypeNameSelectedEnum = {
${config.error.objects.map(_ => `${_.name}: { __typename: '${_.name}' }`).join(`,\n`)}
} as ${config.error.objects.length > 0 ? `const` : `Record<string,ObjectWithTypeName>`}
const ErrorObjectsTypeNameSelectedEnum = {
${config.error.objects.map(_ => `${_.name}: { __typename: '${_.name}' }`).join(`,\n`)}
} as ${config.error.objects.length > 0 ? `const` : `Record<string,ObjectWithTypeName>`}
const ErrorObjectsTypeNameSelected = Object.values(ErrorObjectsTypeNameSelectedEnum)
const ErrorObjectsTypeNameSelected = Object.values(ErrorObjectsTypeNameSelectedEnum)
type ErrorObjectsTypeNameSelected = (typeof ErrorObjectsTypeNameSelected)[number]
`)
type ErrorObjectsTypeNameSelected = (typeof ErrorObjectsTypeNameSelected)[number]
`)

code.push(
`export const isError = <$Value>(value:$Value): value is Include<$Value, ErrorObjectsTypeNameSelected> => {
Expand Down
4 changes: 2 additions & 2 deletions src/layers/2_generator/code/Select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const { generate: generateSelect, moduleName: moduleNameSelect } = create
(config) => {
const code: string[] = []

code.push(`import { Index } from './${moduleNameIndex}.js'`)
code.push(`import { SelectionSet, ResultSet } from '${config.libraryPaths.schema}'`)
code.push(`import type { Index } from './${moduleNameIndex}.js'`)
code.push(`import type { SelectionSet, ResultSet } from '${config.libraryPaths.schema}'`)
code.push(``)

code.push(
Expand Down
2 changes: 1 addition & 1 deletion src/layers/2_generator/code/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const { moduleName: moduleNameGlobal, generate: generateGlobal } = create
const code: string[] = []

code.push(
`import { Index } from './${moduleNameIndex}.js'`,
`import type { Index } from './${moduleNameIndex}.js'`,
)

if (config.typeMapByKind.GraphQLScalarTypeCustom.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion tests/_/schema/generated/Global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Index } from './Index.js'
import type { Index } from './Index.js'

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

Expand Down
4 changes: 2 additions & 2 deletions tests/_/schema/generated/Select.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import { Index } from './Index.js'
import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import type { Index } from './Index.js'

// Runtime
// -------
Expand Down
2 changes: 1 addition & 1 deletion tests/_/schemaMutationOnly/generated/Global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Index } from './Index.js'
import type { Index } from './Index.js'

declare global {
export namespace GraphQLRequestTypes {
Expand Down
4 changes: 2 additions & 2 deletions tests/_/schemaMutationOnly/generated/Select.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import { Index } from './Index.js'
import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import type { Index } from './Index.js'

// Runtime
// -------
Expand Down
2 changes: 1 addition & 1 deletion tests/_/schemaQueryOnly/generated/Global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Index } from './Index.js'
import type { Index } from './Index.js'

declare global {
export namespace GraphQLRequestTypes {
Expand Down
4 changes: 2 additions & 2 deletions tests/_/schemaQueryOnly/generated/Select.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import { Index } from './Index.js'
import type { ResultSet, SelectionSet } from '../../../../src/entrypoints/alpha/schema.js'
import type { Index } from './Index.js'

// Runtime
// -------
Expand Down

0 comments on commit f4b01d7

Please sign in to comment.