Skip to content

client/modules/scalar.ts causes runtime errors when using custom scalars #1337

@P4sca1

Description

@P4sca1

Generated code:

import * as CustomScalars from '../../../scalars.js'
export * from '../../../scalars.js'
export { // 
	MyScalar,
// ...
} from '../../../scalars.js'

// ...

export const $registry = {
	map: {
		MyScalar: MyScalar, // Runtime error
// ...
	},
} as $Registry

In the first export statement, all custom scalars are exported. The next statement explicitly exports all scalars, which is redundant. Later in the runtime scalar registry, the scalar is undefined. This can be fixed in 2 ways:

  1. Change the explicit export to an import statement. The export is unneeded because all scalars are already exported. The CustomScalars import can be changed to a type-only import.
  2. Remove the explicit export and use CustomScalars.MyScalar in the runtime registry.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions