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: fix type mismatch between formatter and conf/CatalogFormatter #1546

Closed
wants to merge 2 commits into from

Conversation

taozhou-glean
Copy link
Contributor

Description

fix type mismatch:

image

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

@vercel
Copy link

vercel bot commented Mar 22, 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 22, 2023 at 1:16AM (UTC)

@@ -61,6 +62,12 @@ expectAssignable<LinguiConfig>({
],
})

// formatter
expectAssignable<LinguiConfig>({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure if this is the right way to add the test, as apparently the same test case also passed on next branch...

Copy link
Collaborator

Choose a reason for hiding this comment

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

this test should be in format-po package.

@@ -62,12 +62,12 @@ export type CatalogFormatter = {
templateExtension?: string
parse(
content: string,
ctx: { locale: string | null; sourceLocale: string; filename: string }
ctx: { locale: string; sourceLocale: string; filename: string }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

from the call site, it looks like the locale is always present, while existing may not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

locale may not be present in case if you generating a template.

Copy link
Collaborator

Choose a reason for hiding this comment

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

please return | null back

@github-actions
Copy link

size-limit report 📦

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

@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (29cad1b) 75.34% compared to head (0b2d276) 75.34%.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1546   +/-   ##
=======================================
  Coverage   75.34%   75.34%           
=======================================
  Files          78       78           
  Lines        1971     1971           
  Branches      515      515           
=======================================
  Hits         1485     1485           
  Misses        375      375           
  Partials      111      111           
Impacted Files Coverage Δ
packages/format-po/src/po.ts 93.44% <ø> (ø)

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.

Copy link
Collaborator

@timofei-iatsenko timofei-iatsenko left a comment

Choose a reason for hiding this comment

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

this is incorrect fix, let me do this properly in another PR.

@@ -61,6 +62,12 @@ expectAssignable<LinguiConfig>({
],
})

// formatter
expectAssignable<LinguiConfig>({
Copy link
Collaborator

Choose a reason for hiding this comment

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

this test should be in format-po package.

@@ -62,12 +62,12 @@ export type CatalogFormatter = {
templateExtension?: string
parse(
content: string,
ctx: { locale: string | null; sourceLocale: string; filename: string }
ctx: { locale: string; sourceLocale: string; filename: string }
Copy link
Collaborator

Choose a reason for hiding this comment

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

please return | null back

@timofei-iatsenko
Copy link
Collaborator

timofei-iatsenko commented Mar 22, 2023

Suppressed by #1547

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.

2 participants