openapi-ts icon indicating copy to clipboard operation
openapi-ts copied to clipboard

Inaccessible 'unique symbol' when using @tanstack/svelte-query

Open Conceptiks opened this issue 10 months ago • 2 comments

Description

When using the @tanstack/svelte-query plugin within fastify, the svelte-query.gen.ts file generates just fine. However, I get the following error in all of my requestResourceOptions():

The inferred type of 'getStatusOptions' references an inaccessible 'unique symbol' type. A type annotation is necessary.ts(2527)
---
Exported variable 'getStatusOptions' has or is using name 'dataTagErrorSymbol' from external module "c:/[redacted]/api/packages/client/node_modules/@tanstack/query-core/build/legacy/hydration-DiTAi-4H" but cannot be named.ts(4023)

I must admit I understand too little to pinpoint exactly what causes this issue, but it definitely prevents me from bundling this in my package. I am more than happy to be of guidance and provide more code snippets here. From what I found, this seems to stem from types being too complex to infer. If this is a case, is there a way to explicitly add type annotations during SDK-generation?

This is my current openapi-ts.config.ts

export default defineConfig({
	client: {
		name: '@hey-api/client-fetch'
	},
	experimentalParser: true,
	input: 'openapi-spec.json',
	output: 'packages/client/src',
	plugins: [
		...defaultPlugins,
		{
			name: '@tanstack/svelte-query'
		},
		{
			name: '@hey-api/schemas',
			type: 'json'
		}
	]
});

Reproducible example or configuration

No response

OpenAPI specification (optional)

No response

System information (optional)

No response

Conceptiks avatar Dec 20 '24 17:12 Conceptiks