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

feat(extractor): support TS experimental decorators #1517

Conversation

timofei-iatsenko
Copy link
Collaborator

Description

Babel parser since 7.21.0 understand both before and after export decorators, so decoratorsBeforeExport parser option is not needed.

But for typescript's legacy decorators which could be applied for class method parameters we need to use different parser plugin.

The problem is that these two plugins are not compatible with each other, so user should choose one. Use standardized decorators in theirs typescript code (default behaviour) or experimental (legacy). For JS code standardized decorators are always applied.

This is more or less aligned with upcoming typescript 5 release https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#decorators

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

Fixes #1512

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 necessary documentation (if appropriate)

}

// dynamicImport
import('./guy').then(a)
import("./guy").then(a)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Prettier change the formatting on save / before commit actions even if this files added as ignored 😬

@vercel
Copy link

vercel bot commented Mar 14, 2023

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

Name Status Preview Comments Updated
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 14, 2023 at 9:54AM (UTC)

@github-actions
Copy link

github-actions bot commented Mar 14, 2023

size-limit report 📦

Path Size
./packages/core/build/esm/index.js 1.57 KB (0%)
./packages/detect-locale/build/esm/index.js 812 B (0%)
./packages/react/build/esm/index.js 1.69 KB (0%)
./packages/remote-loader/build/esm/index.js 7.25 KB (0%)

@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04 🎉

Comparison is base (ba41f35) 74.12% compared to head (9fbd123) 74.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1517      +/-   ##
==========================================
+ Coverage   74.12%   74.16%   +0.04%     
==========================================
  Files          67       67              
  Lines        1863     1866       +3     
  Branches      490      490              
==========================================
+ Hits         1381     1384       +3     
  Misses        380      380              
  Partials      102      102              
Impacted Files Coverage Δ
packages/conf/src/makeConfig.ts 100.00% <ø> (ø)
packages/cli/src/api/extractors/babel.ts 93.75% <100.00%> (+0.64%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@andrii-bodnar andrii-bodnar merged commit 7315a23 into lingui:next Mar 16, 2023
@timofei-iatsenko timofei-iatsenko deleted the feature-support-ts-experimental-decorators branch March 16, 2023 09:32
Comment on lines +5 to +6
// supports typescript legacy decorator on parameters
constructor(@Decorator() param) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

FEATURE REQUEST: V4 does not support extracting from code using legacy decorators
3 participants