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

CSSOptions.preprocessorOptions is missing types #17984

Open
7 tasks done
alex-kinokon opened this issue Aug 31, 2024 · 4 comments · May be fixed by #18001
Open
7 tasks done

CSSOptions.preprocessorOptions is missing types #17984

alex-kinokon opened this issue Aug 31, 2024 · 4 comments · May be fixed by #18001
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)

Comments

@alex-kinokon
Copy link
Contributor

Describe the bug

preprocessorOptions?: Record<string, any>

preprocessorOptions is typed as Record<string, any>, which doesn’t provide any type hints to the user.

Reproduction

N/A

Steps to reproduce

No response

System Info

npmPackages:
    @vitejs/plugin-react: ^4.3.1 => 4.3.1 
    vite: ^5.4.1 => 5.4.2

Used Package Manager

pnpm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Sep 1, 2024

I believe this is expected since we don't want to ship types for them if you've not installed the preprocessor. In typescript, I don't think there's a nice way to conditionally import a dependency's types and use it. We could import it unconditionally so the types will just work whenever you install the dependency, but I believe those who typecheck Vite'd dts will error because the other dependencies aren't installed.

@alex-kinokon
Copy link
Contributor Author

I recommend putting the preprocessorOptions definition in a separate file and just put // @ts-ignore at the top.

@bluwy
Copy link
Member

bluwy commented Sep 2, 2024

Hmm interesting. Would you like to submit a PR to try that out?

@alex-kinokon
Copy link
Contributor Author

@bluwy Please see #18001. I have only added the types for SASS because I’m not sure what the types for other preprocessors are, but feel free to edit it.

@bluwy bluwy added p2-nice-to-have Not breaking anything but nice to have (priority) and removed pending triage labels Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants