Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type declarations #63

Merged
merged 17 commits into from
Jan 31, 2025
Prev Previous commit
Next Next commit
Create readme.md
dy committed Jan 31, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c98376665d35fbbe511da4e20776395b1ed461e7
15 changes: 15 additions & 0 deletions types/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# @types/color-space

* `index.d.ts` exports full space with all conversions.
* `*.d.ts` exports individual color spaces.

Types are kept as meaningfully minimal as possible.
Eg. there's no sense for generic _ColorSpace_ since all subtypes include static members.
There's no sense for _Tuple_ data types like _RgbData_ or even _Vec3_/_Vec4_ since they introduce non-existent layer: simple in-place `[number, number, number]` is enough.

## Why not generating from jsdoc?

* Proper jsdoc declarations introduce hacks to js files and still don't reach correct results.
* JSdoc doesn't provide matching features, eg. merging interfaces, which we need.
* Generated types look wrong: they miss important parts and include jsdocs.
* Current JSDoc serve literally formalized description purpose.