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

[types] Re-export some types at the top level #327

Merged
merged 10 commits into from
Sep 14, 2023
38 changes: 38 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
// Definitions by: Adam Thompson-Sharpe <https://github.com/MysteryBlokHed>
// Minimum TypeScript Version: 4.1
export { default } from "./dist/color";
export type {
ColorConstructor,
ColorObject,
ColorTypes,
Coords,
DefineFunctionCode,
DefineFunctionOptions,
DefineFunctionHybrid,
PlainColorObject,
SpaceAccessor,
ToColorPrototype,
} from "./src/color";

export type { White } from "./src/adapt";

export type { CAT } from "./src/CATs";

export type { Display } from "./src/display";

export type {
Range,
RangeOptions,
MixOptions,
StepsOptions,
} from "./src/interpolation";

export type { Options as ParseOptions } from "./src/parse";

export type { RGBOptions } from "./src/rgbspace";

export type { Options as SerializeOptions } from "./src/serialize";

export type {
Format as SpaceFormat,
CoordMeta,
Ref,
Options as SpaceOptions,
} from "./src/space";
37 changes: 37 additions & 0 deletions types/test/type-accessibility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Testing whether types can be accessed from the main import

import {
// Re-exported from src/color.d.ts
ColorConstructor,
ColorObject,
ColorTypes,
Coords,
DefineFunctionCode,
DefineFunctionOptions,
DefineFunctionHybrid,
PlainColorObject,
SpaceAccessor,
ToColorPrototype,
// Re-exported from src/adapt.d.ts
White,
// Re-exported from src/CATs.d.ts
CAT,
// Re-exported from src/display.d.ts
Display,
// Re-exported from src/interpolation.d.ts
Range,
RangeOptions,
MixOptions,
StepsOptions,
// Re-exported from src/parse.d.ts
ParseOptions,
// Re-exported from src/rgbspace.d.ts
RGBOptions,
// Re-exported from src/serialize.d.ts
SerializeOptions,
// Re-exported from src/space.d.ts
SpaceFormat,
CoordMeta,
Ref,
SpaceOptions,
} from "colorjs.io";
2 changes: 1 addition & 1 deletion types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": { "colorjs.io/*": ["./*"] }
"paths": { "colorjs.io": ["."], "colorjs.io/*": ["./*"] }
}
}