Skip to content

Conversation

@siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented May 31, 2023

Added type-safety for classnames with typescript-plugin-css-modules in the editor.

Unfortunately, tsc doesn't load plugins yet, so we don't get typechecks for classnames in CI and are stuck with declaring loose definitions in global.d.ts for now.

screenshot of code with typescript error for a misspelt classname

Note: Make sure your editor is using the workspace version of typescript to use the plugin. See typescript docs

screenshot of editor which shows the current typescript version

@siddharthkp siddharthkp requested review from a team and mperrotti May 31, 2023 14:21
@changeset-bot
Copy link

changeset-bot bot commented May 31, 2023

⚠️ No Changeset found

Latest commit: 42be9b1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@siddharthkp siddharthkp changed the title Add typescript-plugin-css-modules Add type-safety for classnames May 31, 2023
@siddharthkp siddharthkp requested review from joshblack and removed request for mperrotti May 31, 2023 14:21
@siddharthkp siddharthkp self-assigned this May 31, 2023
@siddharthkp siddharthkp added react skip changeset This change does not need a changelog labels May 31, 2023
Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! 🥳 For the type error, do we need something like: https://www.npmjs.com/package/typescript-plugin-css-modules#user-content-custom-definitions or is what you had before in global.d.ts good to use? 👀

@siddharthkp siddharthkp temporarily deployed to github-pages May 31, 2023 14:27 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3347 May 31, 2023 14:28 Inactive
@siddharthkp siddharthkp changed the title Add type-safety for classnames Add type-safety for classnames in vs code May 31, 2023
@siddharthkp
Copy link
Member Author

siddharthkp commented May 31, 2023

Very cool! 🥳 For the type error, do we need something like: https://www.npmjs.com/package/typescript-plugin-css-modules#user-content-custom-definitions or is what you had before in global.d.ts good to use? 👀

We do :( (updated)

I was hoping we wouldn't need it, only to realise tsc doesn't load plugins

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
dist/browser.esm.js 101.63 KB (0%)
dist/browser.umd.js 102.18 KB (0%)

Merged via the queue into main with commit 4c6d9ff Jun 5, 2023
@siddharthkp siddharthkp deleted the typescript-plugin-css-modules branch June 5, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

react skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants