Skip to content

Commit a7a31ca

Browse files
tainakanchuAvery Pierce
and
Avery Pierce
authored
Change enum declaration in index.d.ts to UnionType (software-mansion#1800)
Co-authored-by: Avery Pierce <[email protected]>
1 parent 1a75299 commit a7a31ca

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

src/index.d.ts

+4-21
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export type NumberArray = NumberProp[] | NumberProp;
1212

1313
export type FillRule = 'evenodd' | 'nonzero';
1414
export type Units = 'userSpaceOnUse' | 'objectBoundingBox';
15+
export type MarkerUnits = 'strokeWidth' | 'userSpaceOnUse';
16+
export type Orient = 'auto' | 'auto-start-reverse';
1517

1618
export type TextAnchor = 'start' | 'middle' | 'end';
1719
export type FontStyle = 'normal' | 'italic' | 'oblique';
@@ -464,38 +466,19 @@ export interface UseProps extends CommonPathProps {
464466
export const Use: React.ComponentClass<UseProps>;
465467
export type Use = React.ComponentClass<UseProps>;
466468

467-
export enum EMaskUnits {
468-
USER_SPACE_ON_USE = 'userSpaceOnUse',
469-
OBJECT_BOUNDING_BOX = 'objectBoundingBox',
470-
}
471-
472-
export type TMaskUnits =
473-
| EMaskUnits.USER_SPACE_ON_USE
474-
| EMaskUnits.OBJECT_BOUNDING_BOX;
475-
476469
export interface MaskProps extends CommonPathProps {
477470
id?: string;
478471
x?: NumberProp;
479472
y?: NumberProp;
480473
width?: NumberProp;
481474
height?: NumberProp;
482475
maskTransform?: ColumnMajorTransformMatrix | string;
483-
maskUnits?: TMaskUnits;
484-
maskContentUnits?: TMaskUnits;
476+
maskUnits?: Units;
477+
maskContentUnits?: Units;
485478
}
486479
export const Mask: React.ComponentClass<MaskProps>;
487480
export type Mask = React.ComponentClass<MaskProps>;
488481

489-
export enum MarkerUnits {
490-
STROKE_WIDTH = 'strokeWidth',
491-
USER_SPACE_ON_USE = 'userSpaceOnUse',
492-
}
493-
494-
export enum Orient {
495-
AUTO = 'auto',
496-
AUTO_START_REVERSE = 'auto-start-reverse',
497-
}
498-
499482
export interface MarkerProps {
500483
id?: string;
501484
viewBox?: string;

src/index.js.flow

+6-20
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export type NumberProp = string | number;
1515
export type NumberArray = NumberProp[] | NumberProp;
1616
export type FillRule = "evenodd" | "nonzero";
1717
export type Units = "userSpaceOnUse" | "objectBoundingBox";
18+
export type MarkerUnits = "strokeWidth" | "userSpaceOnUse";
19+
export type Orient = "auto" | "auto-start-reverse";
1820
export type TextAnchor = "start" | "middle" | "end";
1921
export type FontStyle = "normal" | "italic" | "oblique";
2022
export type FontVariant = "normal" | "small-caps";
@@ -429,35 +431,19 @@ export type UseProps = {
429431
} & CommonPathProps;
430432
declare export var Use: React.ComponentClass<UseProps>;
431433
export type UseType = React.ComponentClass<UseProps>;
432-
declare export var EMaskUnits: {|
433-
+USER_SPACE_ON_USE: "userSpaceOnUse", // "userSpaceOnUse"
434-
+OBJECT_BOUNDING_BOX: "objectBoundingBox", // "objectBoundingBox"
435-
|};
436-
export type TMaskUnits =
437-
| typeof EMaskUnits.USER_SPACE_ON_USE
438-
| typeof EMaskUnits.OBJECT_BOUNDING_BOX;
439434
export type MaskProps = {
440435
id?: string,
441436
x?: NumberProp,
442437
y?: NumberProp,
443438
width?: NumberProp,
444439
height?: NumberProp,
445440
maskTransform?: ColumnMajorTransformMatrix | string,
446-
maskUnits?: TMaskUnits,
447-
maskContentUnits?: TMaskUnits,
441+
maskUnits?: Units,
442+
maskContentUnits?: Units,
448443
...
449444
} & CommonPathProps;
450445
declare export var Mask: React.ComponentClass<MaskProps>;
451446
export type MaskType = React.ComponentClass<MaskProps>;
452-
declare export var MarkerUnits: {|
453-
+STROKE_WIDTH: "strokeWidth", // "strokeWidth"
454-
+USER_SPACE_ON_USE: "userSpaceOnUse", // "userSpaceOnUse"
455-
|};
456-
457-
declare export var Orient: {|
458-
+AUTO: "auto", // "auto"
459-
+AUTO_START_REVERSE: "auto-start-reverse", // "auto-start-reverse"
460-
|};
461447
export interface MarkerProps {
462448
id?: string;
463449
viewBox?: string;
@@ -466,8 +452,8 @@ export interface MarkerProps {
466452
refY?: NumberProp;
467453
markerWidth?: NumberProp;
468454
markerHeight?: NumberProp;
469-
markerUnits?: $Values<typeof MarkerUnits>;
470-
orient?: $Values<typeof Orient> | NumberProp;
455+
markerUnits?: MarkerUnits;
456+
orient?: Orient | NumberProp;
471457
}
472458
declare export var Marker: React.ComponentClass<MarkerProps>;
473459
export type MarkerType = React.ComponentClass<MarkerProps>;

0 commit comments

Comments
 (0)