Skip to content

fix types #1200

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

Merged
merged 18 commits into from
Dec 15, 2023
Merged

fix types #1200

merged 18 commits into from
Dec 15, 2023

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Dec 5, 2023

fixes : #1031


This change makes a different tradeoff.

Instead of trying to have correct types for all users and failing to do so, we could choose to only provide types for part of our users.

In practice our current typings and the entries in package.json are broken.
I think they only work for those who write es module syntax while configuring their TypeScript project for very old node.

I think it's better to make sure it works correctly for modern TypeScript in es modules.
I am making the assumption that those who value typings in build tools are much more likely to be also using es modules for build scripts.

Focussing on es modules, modern TypeScript and modern node has the benefit of being future proof.


The general idea remains the same :

  • the code is bundled, so the types need to be bundled
  • https://api-extractor.com seems to do the trick and this is created by Microsoft, making it a bit safer to add as an extra dependency
  • only the public facing types are exposed

I don't think it is needed to review this change in it's entirety, just too many generated files changed.

example change :

color-helpers:

@romainmenke romainmenke marked this pull request as ready for review December 10, 2023 11:39
Copy link
Member Author

Choose a reason for hiding this comment

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

This file is unused at this time, but I am hoping to use it to resolve : #1201

Actually running it generates hundreds of markdown files with API docs.
So I want to save that for a future PR.

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

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

LGTM! I did a general overview as this became nasty to review!

@romainmenke
Copy link
Member Author

I did a general overview as this became nasty to review!

I feared as much :/
Luckily no test expect files changed and our e2e tests are more accurate now.

Thank you for checking all this 🙇

@romainmenke romainmenke merged commit b43e8f6 into main Dec 15, 2023
@romainmenke romainmenke deleted the fix-types--persistent-puffin-26bee81a68 branch December 15, 2023 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli common-tools e2e experimental plugin-packs/postcss-bundler plugin-packs/postcss-preset-env plugins/css-blank-pseudo plugins/css-has-pseudo plugins/css-prefers-color-scheme plugins/media-queries-aspect-ratio-number-values plugins/postcss-media-queries-aspect-ratio-number-values plugins/postcss-attribute-case-insensitive plugins/postcss-cascade-layers plugins/postcss-color-function plugins/postcss-color-functional-notation plugins/postcss-color-hex-alpha plugins/postcss-color-mix-function plugins/postcss-color-rebeccapurple plugins/postcss-conditional-values plugins/postcss-custom-media plugins/postcss-custom-properties plugins/postcss-custom-selectors plugins/postcss-design-tokens plugins/postcss-dir-pseudo-class plugins/postcss-double-position-gradients plugins/postcss-exponential-functions plugins/postcss-extract plugins/postcss-focus-visible plugins/postcss-focus-within plugins/postcss-font-format-keywords plugins/postcss-gamut-mapping plugins/postcss-gap-properties plugins/postcss-global-data plugins/postcss-gradients-interpolation-method plugins/postcss-hwb-function plugins/postcss-ic-unit plugins/postcss-image-set-function plugins/postcss-initial plugins/postcss-is-pseudo-class plugins/postcss-lab-function plugins/postcss-logical plugins/postcss-logical-float-and-clear plugins/postcss-logical-resize plugins/postcss-logical-viewport-units plugins/postcss-media-minmax plugins/postcss-minify plugins/postcss-nested-calc plugins/postcss-nesting plugins/postcss-normalize-display-values plugins/postcss-oklab-function plugins/postcss-overflow-shorthand plugins/postcss-place plugins/postcss-progressive-custom-properties plugins/postcss-pseudo-class-any-link plugins/postcss-rebase-url plugins/postcss-relative-color-syntax plugins/postcss-scope-pseudo-class plugins/postcss-selector-not plugins/postcss-slow-plugins plugins/postcss-stepped-value-functions PostCSS Stepped Value Functions plugins/postcss-text-decoration-shorthand plugins/postcss-trigonometric-functions PostCSS Trigonometric Functions plugins/postcss-unset-value sites/postcss-preset-env
Projects
None yet
Development

Successfully merging this pull request may close these issues.

packages provide wrong types under node16 module resolution
2 participants