mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 16:17:42 +01:00
replace keyof ReactSVG with SVGElementType (#2668)
* replace `keyof ReactSVG` with `SVGElementType` * define `SVGElementType` locally * 🧹 * update comments * Format types.ts * Update types.ts * Update types.ts --------- Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
forwardRef,
|
||||
createElement,
|
||||
ReactSVG,
|
||||
FunctionComponent,
|
||||
ForwardRefExoticComponent,
|
||||
} from 'react';
|
||||
import { forwardRef, createElement, FunctionComponent } from 'react';
|
||||
import * as NativeSvg from 'react-native-svg';
|
||||
import defaultAttributes, { childDefaultAttributes } from './defaultAttributes';
|
||||
import { IconNode, LucideIcon, LucideProps } from './types';
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
import type { ForwardRefExoticComponent, ReactSVG } from 'react';
|
||||
import type { ForwardRefExoticComponent } from 'react';
|
||||
import type { SvgProps } from 'react-native-svg';
|
||||
|
||||
export type IconNode = [elementName: keyof ReactSVG, attrs: Record<string, string>][];
|
||||
/**
|
||||
* A reduced version of `SVGElementType` from @types/react. This type was added
|
||||
* with the release of React 19, and is included here in order to support usage
|
||||
* with older versions.
|
||||
*/
|
||||
type SVGElementType =
|
||||
| 'circle'
|
||||
| 'ellipse'
|
||||
| 'g'
|
||||
| 'line'
|
||||
| 'path'
|
||||
| 'polygon'
|
||||
| 'polyline'
|
||||
| 'rect';
|
||||
|
||||
export type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][];
|
||||
|
||||
export interface LucideProps extends SvgProps {
|
||||
size?: string | number;
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
import { ReactSVG, SVGProps, ForwardRefExoticComponent, RefAttributes } from 'react';
|
||||
import type { SVGProps, ForwardRefExoticComponent, RefAttributes } from 'react';
|
||||
|
||||
export type IconNode = [elementName: keyof ReactSVG, attrs: Record<string, string>][];
|
||||
/**
|
||||
* A reduced version of `SVGElementType` from @types/react. This type was added
|
||||
* with the release of React 19, and is included here in order to support usage
|
||||
* with older versions.
|
||||
*/
|
||||
type SVGElementType =
|
||||
| 'circle'
|
||||
| 'ellipse'
|
||||
| 'g'
|
||||
| 'line'
|
||||
| 'path'
|
||||
| 'polygon'
|
||||
| 'polyline'
|
||||
| 'rect';
|
||||
|
||||
export type IconNode = [elementName: SVGElementType, attrs: Record<string, string>][];
|
||||
|
||||
export type SVGAttributes = Partial<SVGProps<SVGSVGElement>>;
|
||||
type ElementAttributes = RefAttributes<SVGSVGElement> & SVGAttributes;
|
||||
|
||||
Reference in New Issue
Block a user