mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 16:54:52 +00:00
fix: use export type when exporting types (#1874)
If you built your app using `esbuild` (for example using [`@rnx-kit/metro-serializer-esbuild`](https://microsoft.github.io/rnx-kit/docs/tools/metro-serializer-esbuild)), then it complains that the imports do not exist for type imports. Marking them explicitely as types fixes this issue, in addition to removing those import/exports from non-TS builds. I also transformed them from an import + export statements to an `export … from …` statement.
This commit is contained in:
+50
-69
@@ -1,40 +1,30 @@
|
|||||||
import Shape from './elements/Shape';
|
import Shape from './elements/Shape';
|
||||||
import Rect, { RectProps } from './elements/Rect';
|
import Rect from './elements/Rect';
|
||||||
import Circle, { CircleProps } from './elements/Circle';
|
import Circle from './elements/Circle';
|
||||||
import Ellipse, { EllipseProps } from './elements/Ellipse';
|
import Ellipse from './elements/Ellipse';
|
||||||
import Polygon, { PolygonProps } from './elements/Polygon';
|
import Polygon from './elements/Polygon';
|
||||||
import Polyline, { PolylineProps } from './elements/Polyline';
|
import Polyline from './elements/Polyline';
|
||||||
import Line, { LineProps } from './elements/Line';
|
import Line from './elements/Line';
|
||||||
import Svg, { SvgProps } from './elements/Svg';
|
import Svg from './elements/Svg';
|
||||||
import Path, { PathProps } from './elements/Path';
|
import Path from './elements/Path';
|
||||||
import G, { GProps } from './elements/G';
|
import G from './elements/G';
|
||||||
import Text, { TextProps } from './elements/Text';
|
import Text from './elements/Text';
|
||||||
import TSpan, { TSpanProps } from './elements/TSpan';
|
import TSpan from './elements/TSpan';
|
||||||
import TextPath, { TextPathProps } from './elements/TextPath';
|
import TextPath from './elements/TextPath';
|
||||||
import Use, { UseProps } from './elements/Use';
|
import Use from './elements/Use';
|
||||||
import Image, { ImageProps } from './elements/Image';
|
import Image from './elements/Image';
|
||||||
import Symbol, { SymbolProps } from './elements/Symbol';
|
import Symbol from './elements/Symbol';
|
||||||
import Defs from './elements/Defs';
|
import Defs from './elements/Defs';
|
||||||
import LinearGradient, { LinearGradientProps } from './elements/LinearGradient';
|
import LinearGradient from './elements/LinearGradient';
|
||||||
import RadialGradient, { RadialGradientProps } from './elements/RadialGradient';
|
import RadialGradient from './elements/RadialGradient';
|
||||||
import Stop, { StopProps } from './elements/Stop';
|
import Stop from './elements/Stop';
|
||||||
import ClipPath, { ClipPathProps } from './elements/ClipPath';
|
import ClipPath from './elements/ClipPath';
|
||||||
import Pattern, { PatternProps } from './elements/Pattern';
|
import Pattern from './elements/Pattern';
|
||||||
import Mask, { MaskProps } from './elements/Mask';
|
import Mask from './elements/Mask';
|
||||||
import Marker, { MarkerProps } from './elements/Marker';
|
import Marker from './elements/Marker';
|
||||||
import ForeignObject, { ForeignObjectProps } from './elements/ForeignObject';
|
import ForeignObject from './elements/ForeignObject';
|
||||||
|
|
||||||
import {
|
import { parse, SvgAst, SvgFromUri, SvgFromXml, SvgUri, SvgXml } from './xml';
|
||||||
parse,
|
|
||||||
SvgAst,
|
|
||||||
SvgFromUri,
|
|
||||||
SvgFromXml,
|
|
||||||
SvgUri,
|
|
||||||
SvgXml,
|
|
||||||
UriProps,
|
|
||||||
XmlProps,
|
|
||||||
AstProps,
|
|
||||||
} from './xml';
|
|
||||||
import {
|
import {
|
||||||
SvgCss,
|
SvgCss,
|
||||||
SvgCssUri,
|
SvgCssUri,
|
||||||
@@ -42,12 +32,7 @@ import {
|
|||||||
SvgWithCssUri,
|
SvgWithCssUri,
|
||||||
inlineStyles,
|
inlineStyles,
|
||||||
} from './css';
|
} from './css';
|
||||||
import {
|
import { LocalSvg, WithLocalSvg, loadLocalRawResource } from './LocalSvg';
|
||||||
LocalSvg,
|
|
||||||
WithLocalSvg,
|
|
||||||
loadLocalRawResource,
|
|
||||||
LocalProps,
|
|
||||||
} from './LocalSvg';
|
|
||||||
import {
|
import {
|
||||||
RNSVGCircle,
|
RNSVGCircle,
|
||||||
RNSVGClipPath,
|
RNSVGClipPath,
|
||||||
@@ -72,35 +57,31 @@ import {
|
|||||||
RNSVGUse,
|
RNSVGUse,
|
||||||
} from './elements/NativeComponents';
|
} from './elements/NativeComponents';
|
||||||
|
|
||||||
export {
|
export type { RectProps } from './elements/Rect';
|
||||||
RectProps,
|
export type { CircleProps } from './elements/Circle';
|
||||||
CircleProps,
|
export type { EllipseProps } from './elements/Ellipse';
|
||||||
EllipseProps,
|
export type { PolygonProps } from './elements/Polygon';
|
||||||
PolygonProps,
|
export type { PolylineProps } from './elements/Polyline';
|
||||||
PolylineProps,
|
export type { LineProps } from './elements/Line';
|
||||||
LineProps,
|
export type { SvgProps } from './elements/Svg';
|
||||||
SvgProps,
|
export type { PathProps } from './elements/Path';
|
||||||
PathProps,
|
export type { GProps } from './elements/G';
|
||||||
GProps,
|
export type { TextProps } from './elements/Text';
|
||||||
TextProps,
|
export type { TSpanProps } from './elements/TSpan';
|
||||||
TSpanProps,
|
export type { TextPathProps } from './elements/TextPath';
|
||||||
TextPathProps,
|
export type { UseProps } from './elements/Use';
|
||||||
UseProps,
|
export type { ImageProps } from './elements/Image';
|
||||||
ImageProps,
|
export type { SymbolProps } from './elements/Symbol';
|
||||||
SymbolProps,
|
export type { LinearGradientProps } from './elements/LinearGradient';
|
||||||
LinearGradientProps,
|
export type { RadialGradientProps } from './elements/RadialGradient';
|
||||||
RadialGradientProps,
|
export type { StopProps } from './elements/Stop';
|
||||||
StopProps,
|
export type { ClipPathProps } from './elements/ClipPath';
|
||||||
ClipPathProps,
|
export type { PatternProps } from './elements/Pattern';
|
||||||
PatternProps,
|
export type { MaskProps } from './elements/Mask';
|
||||||
MaskProps,
|
export type { MarkerProps } from './elements/Marker';
|
||||||
MarkerProps,
|
export type { ForeignObjectProps } from './elements/ForeignObject';
|
||||||
ForeignObjectProps,
|
export type { LocalProps } from './LocalSvg';
|
||||||
UriProps,
|
export type { UriProps, XmlProps, AstProps } from './xml';
|
||||||
XmlProps,
|
|
||||||
AstProps,
|
|
||||||
LocalProps,
|
|
||||||
};
|
|
||||||
|
|
||||||
export * from './lib/extract/types';
|
export * from './lib/extract/types';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user