Skip to content

Commit ff1a85c

Browse files
committedFeb 24, 2025··
fix: set return type to string
This will fix many of the issues when using typescript-eslint.
1 parent 27bd01c commit ff1a85c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
 

‎src/fast.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { type ColorSpace, getColorSpace } from "./supports";
22
import { ansi256To16, hexToRgb, rgbToAnsi16, rgbToAnsi256 } from "./utils";
33

4-
type FarveFn<T = string | boolean | number | null | undefined | void> = (
5-
text: T,
6-
) => T;
4+
type FarveFn = (
5+
text: string | boolean | number | null | undefined,
6+
) => string;
77

88
export interface FastFarver {
99
// modifiers

‎src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { type ColorSpace, getColorSpace } from "./supports";
22
import { ansi256To16, hexToRgb, rgbToAnsi16, rgbToAnsi256 } from "./utils";
33

4-
export type Farve<T = string | boolean | number | null | undefined | void> = (
5-
text: T,
6-
) => T;
4+
export type Farve = (
5+
text: string | boolean | number | null | undefined,
6+
) => string;
77

88
interface Farver {
99
// modifiers
@@ -73,7 +73,7 @@ function createWrap(colorSpace: ColorSpace, colors: Farver) {
7373
end: number | string,
7474
): ChainedFarve {
7575
if (!enabled) {
76-
return chain((text) => text, colors) as ChainedFarve;
76+
return chain((text) => `${text}`, colors) as ChainedFarve;
7777
}
7878
return chain((text) => {
7979
if (typeof text !== "string") {

0 commit comments

Comments
 (0)
Please sign in to comment.