codebox / moment-precise-range

A moment.js plugin to display human-readable date/time ranges
https://codebox.net/pages/moment-date-range-plugin
MIT License
150 stars 91 forks source link

Could not find a declaration file for module 'moment-precise-range-plugin' #25

Closed chrisj-skinner closed 7 years ago

chrisj-skinner commented 7 years ago

I get the following typescript error when trying to import the plugin into angular 4 using Typescript

import { moment } from 'moment-precise-range-plugin';

Error: Could not find a declaration file for module 'moment-precise-range-plugin'. 'c:/Users/[UserName]/app/node_modules/moment-precise-range-plugin/moment-precise-range.js' implicitly has an 'any' type. Try npm install @types/moment-precise-range-plugin if it exists or add a new declaration (.d.ts) file containing declare module 'moment-precise-range-plugin';'

Is this the correct way?

codebox commented 7 years ago

Sorry, I have never used Angular 4 or Typescript so I don't know what this error means. I don't think this is a problem with the code in this repo so I will close this issue.

chrisj-skinner commented 7 years ago

It's not an issue with the code in the app but with the method of importing the app using import - do you have a suggested solution? @ https://codebox.org.uk/pages/moment-date-range-plugin you give node'js require('moment-precise-range-plugin'); - what I'm asking is how the app can be required using Typescript (ES6).

Using import { moment } from 'moment-precise-range-plugin'; fails - how would I use this app with ES6?