From 7a88ba17229d902570717692f599c471342abb9f Mon Sep 17 00:00:00 2001 From: Jonny Gerig Meyer Date: Thu, 29 Feb 2024 14:55:05 -0500 Subject: [PATCH] Export types at top level of /fn entrypoint --- types/src/index-fn.d.ts | 34 +++++++++++++++++++++++++++++ types/test/type-fn-accessibility.ts | 32 +++++++++++++++++++++++++++ types/tsconfig.json | 6 ++++- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 types/test/type-fn-accessibility.ts diff --git a/types/src/index-fn.d.ts b/types/src/index-fn.d.ts index 4d9091f84..18bf585ed 100644 --- a/types/src/index-fn.d.ts +++ b/types/src/index-fn.d.ts @@ -27,3 +27,37 @@ export * from "./deltaE/index.js"; export { default as deltaEMethods } from "./deltaE/index.js"; export * from "./variations.js"; export * from "./spaces/index-fn.js"; + +export type { + ColorConstructor, + ColorObject, + ColorTypes, + Coords, + PlainColorObject, +} from "./color.js"; + +export type { White } from "./adapt.js"; + +export type { CAT } from "./CATs.js"; + +export type { Display } from "./display.js"; + +export type { + Range, + RangeOptions, + MixOptions, + StepsOptions, +} from "./interpolation.js"; + +export type { Options as ParseOptions } from "./parse.js"; + +export type { RGBOptions } from "./rgbspace.js"; + +export type { Options as SerializeOptions } from "./serialize.js"; + +export type { + Format as SpaceFormat, + CoordMeta, + Ref, + Options as SpaceOptions, +} from "./space.js"; diff --git a/types/test/type-fn-accessibility.ts b/types/test/type-fn-accessibility.ts new file mode 100644 index 000000000..7275a6deb --- /dev/null +++ b/types/test/type-fn-accessibility.ts @@ -0,0 +1,32 @@ +// Testing whether types can be accessed from the /fn import + +import { + // Re-exported from src/color.d.ts + ColorConstructor, + ColorObject, + ColorTypes, + Coords, + PlainColorObject, + // 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/fn"; diff --git a/types/tsconfig.json b/types/tsconfig.json index 3bb902a76..6caf5cd75 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -10,6 +10,10 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "baseUrl": ".", - "paths": { "colorjs.io": ["."], "colorjs.io/*": ["./*"] } + "paths": { + "colorjs.io": ["."], + "colorjs.io/fn": ["./src/index-fn.js"], + "colorjs.io/*": ["./*"] + } } }