nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
615 stars 191 forks source link

Exporting for TypeScript #152

Closed rashdeva closed 7 years ago

rashdeva commented 7 years ago

Hi! Many people use your plugin in typescript environment and they need to import your plugin. Can you add either js export class or d.ts support for? It will help to use your plugin like NPM package.

For example, now I use your plugin with angular2 and after importing plugin to my .ts file I have next error:

image

My import: import PickMeUp from 'pickmeup/js/pickmeup.js'

nazar-pc commented 7 years ago

I'm not using TypeScript and have no idea how it works.

Nevertheless, ES2015 imports only work in single latest version of Safari. Until it is supported in 2 latest versions of each major evergreen browser I wouldn't add class export here.

This plugin is targeted for browser environment, so use RequireJS/Alameda to load it asynchronously when you need it:

require(['PickMeUp'], function (PickMeUp) {
    ...
});

I don't want people to require custom build systems just because someone is using TypeScript or React's JSX or something else that is not native to browsers.