jmdobry / CacheFactory

CacheFactory is a very simple and useful synchronous key-value store for the browser.
http://www.pseudobry.com/CacheFactory
MIT License
30 stars 18 forks source link

feat: TS provide consistent typescript definition #28

Closed Delagen closed 7 years ago

Delagen commented 7 years ago

For example valid TS code

import * as CacheFactory from "cachefactory";
const cache:CacheFactory.Cache = new CacheFactory.Cache();
Delagen commented 7 years ago

@jmdobry please merge it

fracz commented 7 years ago

Thank you for these typings! One suggestion - wouldn't it be better to be declared as a module? import {CacheFactory} from "cachefactory" would make more sense to me.

Delagen commented 7 years ago

@fracz It can be rewritten easy, but for this module must be bundled the same For current it exports directly constructor for commonjs and if you choose es2015 it will be default export ie

import CacheFactory from "cachefactory"

which also not recommended

Delagen commented 7 years ago

@fracz made #29 that override this in favour of consistent export @jmdobry consider this when merge

jmdobry commented 7 years ago

So close #28 in favor of #29?

Delagen commented 7 years ago

@jmdobry I agree with both. But in case of consistensy preferred #29 PS. Also please notice that it can broke dependent code.

jmdobry commented 7 years ago

Closing in favor of #29