DeltaE icon indicating copy to clipboard operation
DeltaE copied to clipboard

Add TypeScript definitions

Open jem-computer opened this issue 7 years ago • 4 comments
trafficstars

Thanks for a great library! I had to add this file to get things moving in a TypeScript project; hope it's helpful if I share them :)

jem-computer avatar Mar 29 '18 19:03 jem-computer

Thanks for the PR!

I'm familiar with the concept of TS, but not its implementation. How might I go about testing this implementation you've created? I'd like to set something up on a CodePen or similar so I can verify completeness before merging.

Cheers!

zschuessler avatar Mar 30 '18 14:03 zschuessler

LGTM

Note: there's nothing really to test here. What's implemented here are only type definitions. A test would be to implement unit tests in typescript & require tests also pass typechecking when being transpiled

serprex avatar Dec 18 '18 20:12 serprex

@jongold Maybe instead of an interface for "Lab", you could use a type?

export type Lab = {
  L: number;
  A: number;
  B: number;
}

Declaring an interface may conflict with interfaces of similar names in the file where it is used. And types give you code completion too.

https://www.typescriptlang.org/docs/handbook/advanced-types.html#interfaces-vs-type-aliases

lsalazarm99 avatar Aug 03 '20 02:08 lsalazarm99

@lsalazarm99 whoa, thanks! that clarifies a lot; always been confused about the difference between the two. I don't have time to make the change right now but feel free to PR!

jem-computer avatar Aug 03 '20 17:08 jem-computer