Skip to content

Commit f725cc2

Browse files
committed
fix(types): 🐛 fix template literal types causing the build fail
1 parent fe27cd0 commit f725cc2

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/toast/ToastBar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from "react";
22
import { cx } from "@renderlesskit/react";
33

44
import { useTheme } from "../theme";
5-
import { Split } from "../utils/types";
5+
// import { Split } from "../utils/types";
66
import { isFunction, objectKeys } from "../utils";
77
import { useHover, useMediaQuery } from "../hooks";
88
import { Toast, ToastPlacement, useToasts, useToastsReturnType } from "./index";
@@ -34,7 +34,7 @@ export type ToastsContainerProps = {
3434

3535
export const ToastsContainer = (props: ToastsContainerProps) => {
3636
const { toasts, placement, updateHeight, calculateOffset } = props;
37-
const [side, position] = placement.split("-") as Split<typeof placement, "-">;
37+
const [side, position] = placement.split("-") as any;
3838

3939
const [isMobile] = useMediaQuery("(max-width: 640px)");
4040
const { hoverProps, isHovered } = useHover();
@@ -113,7 +113,7 @@ export const StackableToast = (props: StackableToastProps) => {
113113
);
114114

115115
const isToastVisible = visible;
116-
const [side, position] = placement.split("-") as Split<typeof placement, "-">;
116+
const [side, position] = placement.split("-") as any;
117117
const sortedIndex = toastsLength - (index + 1);
118118
const clampedIndex =
119119
sortedIndex > visibleToasts ? visibleToasts : sortedIndex;

src/utils/types.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ export type AnyString = string & { ignore?: any };
4545

4646
export type Dict<T = any> = Record<string, T>;
4747

48-
export type Split<T, K extends string> = T extends `${infer P1}${K}${infer P2}`
49-
? [P1, ...Split<P2, K>]
50-
: [T];
48+
// export type Split<T, K extends string> = T extends `${infer P1}${K}${infer P2}`
49+
// ? [P1, ...Split<P2, K>]
50+
// : [T];
5151

5252
export type DeepPartial<T> = {
5353
[P in keyof T]?: DeepPartial<T[P]>;

0 commit comments

Comments
 (0)