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

fix: compile should generate a TS file #1851

Merged
merged 4 commits into from Feb 20, 2024

Conversation

vonovak
Copy link
Collaborator

@vonovak vonovak commented Feb 15, 2024

Description

Currently, running lingui compile --typescript produces a .ts (which contains javascript code) file along with .d.ts file with typings.

However, TypeScript, at least on my machine, ignores the typings file - which kinda makes sense given that the source file already has .ts extension.

So it looks like this:

Screenshot 2024-02-14 at 20 02 03

AFAICT, we should not mix .ts with .d.ts. What this PR does is that it removes the generation of the d.ts file and instead puts the types into the generated .ts file. I believe this should not have any unintended side effects. If it does, we should keep the .d.ts file but change the .ts file extension.

Additionally, I made some docs changes to "promote" the --typescript flag more. I think most users are not aware of it, yet it's nice to have.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

Copy link

vercel bot commented Feb 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2024 2:17pm

Copy link

github-actions bot commented Feb 15, 2024

size-limit report 📦

Path Size
./packages/core/dist/index.mjs 2.86 KB (0%)
./packages/detect-locale/dist/index.mjs 723 B (0%)
./packages/react/dist/index.mjs 1.67 KB (0%)
./packages/remote-loader/dist/index.mjs 7.26 KB (0%)

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (685730f) 76.39% compared to head (2c80858) 76.66%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1851      +/-   ##
==========================================
+ Coverage   76.39%   76.66%   +0.26%     
==========================================
  Files          81       81              
  Lines        2072     2083      +11     
  Branches      529      532       +3     
==========================================
+ Hits         1583     1597      +14     
+ Misses        377      375       -2     
+ Partials      112      111       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

website/docs/ref/cli.md Outdated Show resolved Hide resolved
packages/cli/src/lingui-compile.ts Show resolved Hide resolved
Copy link
Contributor

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

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

@vonovak thank you!

website/docs/tutorials/react.md Outdated Show resolved Hide resolved
website/docs/tutorials/setup-react.md Outdated Show resolved Hide resolved
@andrii-bodnar andrii-bodnar merged commit e4fbd59 into lingui:main Feb 20, 2024
17 checks passed
@vonovak vonovak deleted the fix/ts-compile branch February 20, 2024 15:41
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

Successfully merging this pull request may close these issues.

None yet

2 participants