Repository navigation
Conversation
The TypeScript theme file imports @xstyled/system. pnpm and Yarn Plug'n'Play do not expose that package unless it is a direct dependency, so the import and the module augmentation fail. The other setup samples were missing styled-components, prop-types, or Babel 7 the same way. Co-authored-by: Evan Jacobs <quantizor@users.noreply.github.com>
|
The bindings re-export Theme, so the theme sample augments the package the app already installed. Prop types import compose, space, and color from the styled-components binding. The Babel 7 pin stays, and the Yarn 1 note covers only the prop-types peer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The theme declaration was importing
@xstyled/systemand augmenting that module.@xstyled/styled-componentsand@xstyled/emotionalready re-exportTheme, so that sample does not need a direct@xstyled/systemdependency. The declaration file now augments the binding the app installed.colorsis omitted and then intersected with the extra token, because replacing the default palette outright is a type error.Install lines for the styled-components and Emotion getting-started samples stay on the packages those samples import.
@xstyled/system's own install staysnpm install @xstyled/system. The readme example, which importsstyled-components, has that install next to the example.The prop-types sample imports
styled,compose,space, andcolorfrom@xstyled/styled-components.prop-typesis a peer of@xstyled/prop-types. npm and pnpm install it. Yarn 1 does not, and the note says so.The Emotion Babel preset still pins
@babel/core@^7. Babel 8 breaks the preset withpath.hoist is not a function.Test plan
Fresh projects, published packages, Node 22.23.4, npm 10.9.9, pnpm 10.33.0, Yarn 1.22.22. TypeScript 7.0.2 and 5.9.3,
moduleResolution: Node16,skipLibCheck: true.styled-componentsplus@xstyled/styled-components: the providers load on npm and pnpm (xobject,defaultThemeobject,ThemeProviderfunction,Preflightobject). The import typechecks. pnpmrequire.resolve('@xstyled/system')isMODULE_NOT_FOUND. The newstyled.d.tsstill typechecks on npm, pnpm, and Yarn 1, on TypeScript 7.0.2 and 5.9.3.ThemeColorandSystemProps['color']acceptblue-500andbrandand rejectzzz-not-a-color.useTheme().colors.brandisstring. Yarn 1 needsreactandreact-dombefore the binding loads. That peer is outside this change.jsxis a function.x.button'scolorrejectszzz-not-a-color.@xstyled/systemalone:import { system }printsfunctionon npm, pnpm, and Yarn 1. After addingstyled-components,styled.div(system)returns an object throughstyled-components/dist/styled-components.esm.js. The package's default import under Node is the CJS namespace, sostyled.divisundefined. Yarn 1 also needsreactbefore that file loads.prop-types:require('@xstyled/prop-types')pluscompose(space, color)from the binding returns the margin, padding, and color keys on npm and pnpm.styled.divis a function. pnpm nestsprop-typesand does not link it at the top ofnode_modules. The sample typechecks. Yarn 1 withoutprop-typesthrowsCannot find module 'prop-types'from the CommonJS entry andCannot find package 'prop-types'from the ESM entry. Withprop-typesandreactinstalled, the CommonJS call returns the same keys.node --input-type=moduleimportinggetSystemPropTypesthrowsSyntaxError: Named export 'bool' not foundon npm and pnpm. Left unfixed.React.ComponentProps<typeof x.button>['color']acceptszzz-not-a-colorafter the augmentation. Left unfixed. Emotion'sx.buttoncolor is strict.@babel/core@^7: npm, pnpm, and Yarn 1 transform acssprop with Babel 7.29.7. Yarn 1 with an unpinned@babel/coregets 8.0.10 and throwspath.hoist is not a function.