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

TS typings error with .module.pcss extension #3518

Closed
6 tasks done
edikdeisling opened this issue May 24, 2021 · 0 comments · Fixed by #3519
Closed
6 tasks done

TS typings error with .module.pcss extension #3518

edikdeisling opened this issue May 24, 2021 · 0 comments · Fixed by #3519

Comments

@edikdeisling
Copy link
Contributor

edikdeisling commented May 24, 2021

Describe the bug

When we import pcss module

import styles from './index.module.pcss';

We get a TS error when trying to get class from styles (console.log(styles.button))

TS2339: Property 'button' does not exist on type 'string'

Reproduction

You need to create file with .module.pcss extension and import it in code.

I think this caused by vite/packages/vite/client.d.ts file. We have there declare module '*.module.css', but don't have declare module '*.module.pcss'

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
	OS: Windows 10 10.0.19042
	CPU: (6) ia32 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
	Memory: 6.71 GB / 15.94 GB
Binaries:
	Node: 14.17.0 - C:\Program Files (x86)\nodejs\node.EXE
	Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
	npm: 6.14.13 - C:\Program Files (x86)\nodejs\npm.CMD
Browsers:
	Edge: Spartan (44.19041.423.0), Chromium (90.0.818.66)
	Internet Explorer: 11.0.19041.1
npmPackages:
	vite: 2.3.1 => 2.3.1

Used package manager: yarn


Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
edikdeisling added a commit to edikdeisling/vite that referenced this issue May 24, 2021
ygj6 pushed a commit to ygj6/vite that referenced this issue Jun 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant