nuxt-community / moment-module

Efficient Moment.js integration for Nuxt
MIT License
195 stars 12 forks source link

feat: improve types #47

Closed P4sca1 closed 4 years ago

P4sca1 commented 5 years ago

$moment is injected using nuxt inject method and is therefore also available in vuex. This adds types to the vuex store.

Also no longer limit the type to (input?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment but use typeof moment. This makes it possible to do something like this.$moment.duration().

The README is updated to contain info about how to use this module with typescript. I was wondering why this.$moment was untyped and found out you have to add @nuxtjs/moment to the types array in your tsconfig.json. Thought it would make sense to include this in the README.

codecov[bot] commented 5 years ago

Codecov Report

Merging #47 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #47   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          13     13           
  Branches        2      2           
=====================================
  Hits           13     13

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 eed4398...eef27e8. Read the comment docs.

P4sca1 commented 5 years ago

@kevinmarrec As you made the initial types, could you take a look at this?