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
feedback for "fix type definitions" #1830
Comments
Pull request with the updated postcss version : https://github.com/csstools/postcss-plugins/pull/945/files |
Thanks for the feedback! That’s some weird error I’ve never seen before. It goes away when adding an explicit return type annotation to that function instead of inferring it. Of course the goal of #1815 is to be backwards compatible. I found out that it’s fixed, if the types it’s complaining about are exported. Is that solution acceptable? As a side note: The type definitions of |
Correct, it is the best that can be achieved. I personally gave up on this and don't want to waste any more of my time on the entire esm vs. commonjs typing mess :D Maybe one day this will be solved by TypeScript/tooling. (pull requests are always welcome :) ) |
@romainmenke how did you fix it (I see CI is green)? |
CI is green because TypeScript was still able to transpile to JS, even with these errors. |
I found an example warning in the logs: https://github.com/csstools/postcss-plugins/actions/runs/4686379592/jobs/8304403257?pr=945#step:7:319 |
@ai If so, I’ll gladly add that. I think that would be the last remaining issue. |
I am too 😅 Maintaining PostCSS could be hard.
What we could recommend to users who will face it? |
Sorry, I think you misunderstood my comment. I meant those errors go away if PostCSS exports the We could annotate them with an |
Yes, let’s add them for export.
No, then can be useful for complex types. |
Done! |
Thanks for the feedback! |
Still seeing a single warning :
|
@remcohaszing can we fix it by moving some types from namespaces?
|
We really don’t put that many types inside namespaces. I.e. TypeScript 4 and I managed to resolve it by removing intermediate class declarations for default exports. It even simplifies the types a bit. I tried this, because I had a hunch it might help. I don’t actually understand why it helps. My guess is the intermediate class declaration counts as another internal type that can’t be resolved, just like |
@romainmenke can you check the last commit? |
This seems to resolve all warnings. The output is a bit different, but this is likely expected? |
I don't know why TypeScript changed the emitted output, but both resolves to the same type, so it's fine. The resolved type annotation is even compatible with the postcss types before #1815 |
We changed types exports, so these changes are expected. But they are not critical. Both options are public API. |
Awesome! Thank you for working through this feedback 🎉 |
see : #1815
With source :
We get these errors :
The text was updated successfully, but these errors were encountered: