Skip to content

Commit 783f7d7

Browse files
committed
fix ts SVG issue
1 parent 96d2754 commit 783f7d7

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

custom.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.svg" {
2+
const content: React.ElementType<React.SVGProps<SVGSVGElement>>;
3+
export default content;
4+
}

index.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { CSSProperties, ForwardedRef, ReactNode } from "react";
22

3-
declare module "*.svg" {
4-
const content: string;
5-
export default content;
6-
}
7-
83
export type SortDirection = "ASC" | "DESC" | null;
94

105
type CacheFunction = (dataIndex: number, forceUpdate?: boolean) => void;

src/Row.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import React, { SVGProps, useCallback, useContext, useLayoutEffect, useRef } from "react";
2-
import { CacheFunction, ColumnProps, RowRenderProps, SubComponentProps } from "../index";
3-
//@ts-ignore TS2307
4-
import Minus from "./svg/minus-circle.svg";
1+
import React, { useCallback, useContext, useLayoutEffect, useRef } from "react";
52
import { ListChildComponentProps } from "react-window";
3+
import { CacheFunction, ColumnProps, RowRenderProps, SubComponentProps } from "../index";
64
import { TableContext } from "./TableContext";
7-
//@ts-ignore TS2307
5+
import Minus from "./svg/minus-circle.svg";
86
import Plus from "./svg/plus-circle.svg";
97
import { cx } from "./util";
108

@@ -84,7 +82,7 @@ const TableCell = React.memo(function <T>({
8482
// expander
8583
if (column.expander) {
8684
if (typeof column.expander === "boolean") {
87-
const Logo: React.ElementType<SVGProps<SVGSVGElement>> = isExpanded ? Minus : Plus;
85+
const Logo = isExpanded ? Minus : Plus;
8886

8987
return (
9088
<div className="cell" style={style}>

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"include": [
1919
"index.d.ts",
20+
"custom.d.ts",
2021
"src/**/*"
2122
],
2223
"exclude": [

0 commit comments

Comments
 (0)