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

⚡improvement(types): typed autocomplete in date and number format options #485

Merged
merged 2 commits into from
Dec 17, 2018

Conversation

Raiondesu
Copy link
Contributor

Replaces Number and Date format options with standard TS Intl types, while also adding guiding TS autocomplete to them.

This change exterminates the confusion of which types to follow, while preserving backwards-compatibility for types and adding optional autocomplete.

This means that upon typing certain formats, the editor will be able to autocomplete some values following MDN guidelines if using typescript:

vuei18n.setDateTimeFormat('en', {
  long: {
    month: '' // Here, TS will suggest 'numerc', '2-digit', 'short', 'long' or 'narrow'
  }
}

while also not restricting anything. So the following will be valid too:

vuei18n.setDateTimeFormat('en', {
  long: {
    month: 'beliberda'
  }
}

essentially making these types backward-compatible with previous versions of vue-i18n.

…ions

Replace Number and Date format options with standard TS `Intl` types, while also adding guiding TS autocomplete to them.

This change exterminates the confusion of which types to follow, while preserving backwards-compatibility for types and adding optional autocomplete.
@codecov-io
Copy link

Codecov Report

Merging #485 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #485   +/-   ##
=======================================
  Coverage   96.67%   96.67%           
=======================================
  Files           9        9           
  Lines         662      662           
=======================================
  Hits          640      640           
  Misses         22       22

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef4b1a6...ff75258. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Dec 16, 2018

Codecov Report

Merging #485 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev     #485   +/-   ##
=======================================
  Coverage   96.67%   96.67%           
=======================================
  Files           9        9           
  Lines         662      662           
=======================================
  Hits          640      640           
  Misses         22       22

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ef4b1a6...70594de. Read the comment docs.

It's useful to check static variables types whenever possible.
Copy link
Owner

@kazupon kazupon left a comment

Choose a reason for hiding this comment

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

Great work! 🎉
Thanks!

@kazupon kazupon merged commit e2e5993 into kazupon:dev Dec 17, 2018
@Raiondesu Raiondesu deleted the patch-1 branch December 17, 2018 08:51
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.

3 participants