graypegg / chromatism

:rainbow: A simple set of utility functions for colours.
1.78k stars 37 forks source link

Typings is incorrect #15

Closed etienne-dldc closed 7 years ago

etienne-dldc commented 7 years ago

Hi,

The module is typed as exporting all function while it's a default import.

So import { brightness } from 'chromatism' or import * as chromatism from 'chromatism' does not throw typing error but does not work (chromatism_1.brightness is not a function). But import chromatism from 'chromatism' does not pass type checking : error TS1192: Module '"~/node_modules/chromatism/index"' has no default export.

The following index.d.tsshould fix this :

declare namespace Chromatism {
     // All the code of the old `index.d.ts`
}

export default Chromatism;

Etienne.

graypegg commented 7 years ago

Currently on holiday in the UK with some pretty spotty wifi, thanks for your suggestion, but I won't be able to fix this up before I get back! Thanks so much again!

etienne-dldc commented 7 years ago

I can do a PR if you want ☺️

graypegg commented 7 years ago

Yes please if you can! I'm back on the 21st-22nd, should be able to merge your stuff in then or fix stuff up myself! Thanks so much again!

TehShrike commented 7 years ago

Worth noting that it's probably best to update the typings in the refactor branch, where there are breaking API changes that should be merged/released in the next couple weeks.

graypegg commented 7 years ago

Not needed now that we're using ES6 named exports