Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid module paths in generated types file on Windows #583

Closed
Hirtol opened this issue Oct 2, 2022 · 2 comments · Fixed by #585
Closed

Invalid module paths in generated types file on Windows #583

Hirtol opened this issue Oct 2, 2022 · 2 comments · Fixed by #585

Comments

@Hirtol
Copy link

Hirtol commented Oct 2, 2022

Describe the bug

In a Windows 10 environment, when using TypeScript, SvelteKit, and Houdini, the generated $houdini.d.ts looks as follows for me:

import type * as Kit from '@sveltejs/kit';
import type { VariableFunction, AfterLoadFunction, BeforeLoadFunction }  from '..\..\../runtime/lib/types'
import type { PageLoadEvent, PageData as KitPageData } from './$types'

import { getAllPromotions$result, getAllPromotions$input } from '..\..\../artifacts/getAllPromotions'
import { getAllPromotionsStore } from '..\..\../stores/getAllPromotions'

type Params = PageLoadEvent['params']

export type PageData = {
	getAllPromotions: getAllPromotionsStore
}    

Note the \.. in several relative paths, these are parsed as attempts to escape the . character, and not actually fullfilling their purpose of path separator. This causes import errors in the main SvelteKit app. Maybe there is a way to make TypeScript accept them (I rarely do anything in web-dev, sorry!), but I don't know of it atm.

It seems to be originating here:

const houdiniRelative = path.relative(target, config.typeRootDir)

And from a brief look at stack overflow changing it to path.posix.relative(..) should suffice.

Severity

annoyance

Steps to Reproduce the Bug

  1. Basic Svelte app in Windows 10 environment.
  2. Create basic query
  3. Generate the types

Reproduction

No response

@jycouet
Copy link
Contributor

jycouet commented Oct 3, 2022

Good catch, thanks.
Do you want to open a PR? I'll do it at the end of the day if not.

@Hirtol
Copy link
Author

Hirtol commented Oct 4, 2022

Good catch, thanks. Do you want to open a PR? I'll do it at the end of the day if not.

Apologies for the late response, I had no time yesterday.
Thanks for looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants