[go: nahoru, domu]

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

CSS Modules composes properties and default v. named exports #266

Open
wegry opened this issue Jun 6, 2024 · 0 comments
Open

CSS Modules composes properties and default v. named exports #266

wegry opened this issue Jun 6, 2024 · 0 comments

Comments

@wegry
Copy link
wegry commented Jun 6, 2024

Describe the bug

Similar to #207, we have a project using typescript-plugin-css-modules@5.1.0 (and all default plugin options usage), in it, we use CSS Modules exclusively with named exports.

There seem to be different numbers of exports between the default and namedExports.

To Reproduce
Steps to reproduce the behavior:

  1. Using typescript-plugin-css-modules@5.1.0 and typescript@5.4.3.
  2. With this example css module:
/* theme-typography.module.css */
.aliasingBase {
	-webkit-font-smoothing: antialiased;
}

.h1 {
	composes: aliasingBase;

	font-weight: 300;
}
  1. With the following snippet:
import * as sColors from './theme-colors.module.css';
import * as sLayout from './theme-layout.module.css';
import * as sMisc from './theme-misc.module.css';
import * as sShadow from './theme-shadow.module.css';
import * as sSpacing from './theme-spacing.module.css';
import * as sText from './theme-text.module.css';
import * as sTypo from './theme-typography.module.css';

const s = {...sColors, ...sMisc, ...sTypo, ...sText, ...sLayout, ...sShadow, ...sSpacing};

export function themeCx(props: AllTokens): string {
  const normalized = normalize(props);
  return cx(s, normalized);
}
// s has ~40ish keys on the default export and ~268 named exports besides default
  1. edit: I remembered that adding composes to a css module makes the types for plugin's named exports stop working. There's only a default export in that case and no namedExports.

Expected behavior

Adding composes should continue exporting namedExports from the CSS modules they're contained in.

Desktop (please complete the following information):

  • OS: macOS 14.5
  • Node Version: 20.12
@wegry wegry closed this as completed Jun 6, 2024
@wegry wegry closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2024
@wegry wegry reopened this Jun 6, 2024
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

No branches or pull requests

1 participant