Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change enum declaration in index.d.ts to UnionType #1800

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export type NumberArray = NumberProp[] | NumberProp;

export type FillRule = 'evenodd' | 'nonzero';
export type Units = 'userSpaceOnUse' | 'objectBoundingBox';
export type MarkerUnits = 'strokeWidth' | 'userSpaceOnUse';
export type Orient = 'auto' | 'auto-start-reverse';

export type TextAnchor = 'start' | 'middle' | 'end';
export type FontStyle = 'normal' | 'italic' | 'oblique';
Expand Down Expand Up @@ -468,38 +470,19 @@ export interface UseProps extends CommonPathProps {
export const Use: React.ComponentClass<UseProps>;
export type Use = React.ComponentClass<UseProps>;

export enum EMaskUnits {
USER_SPACE_ON_USE = 'userSpaceOnUse',
OBJECT_BOUNDING_BOX = 'objectBoundingBox',
}

export type TMaskUnits =
| EMaskUnits.USER_SPACE_ON_USE
| EMaskUnits.OBJECT_BOUNDING_BOX;

export interface MaskProps extends CommonPathProps {
id?: string;
x?: NumberProp;
y?: NumberProp;
width?: NumberProp;
height?: NumberProp;
maskTransform?: ColumnMajorTransformMatrix | string;
maskUnits?: TMaskUnits;
maskContentUnits?: TMaskUnits;
maskUnits?: Units;
maskContentUnits?: Units;
}
export const Mask: React.ComponentClass<MaskProps>;
export type Mask = React.ComponentClass<MaskProps>;

export enum MarkerUnits {
STROKE_WIDTH = 'strokeWidth',
USER_SPACE_ON_USE = 'userSpaceOnUse',
}

export enum Orient {
AUTO = 'auto',
AUTO_START_REVERSE = 'auto-start-reverse',
}

export interface MarkerProps {
id?: string;
viewBox?: string;
Expand Down
29 changes: 8 additions & 21 deletions src/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type NumberProp = string | number;
export type NumberArray = NumberProp[] | NumberProp;
export type FillRule = "evenodd" | "nonzero";
export type Units = "userSpaceOnUse" | "objectBoundingBox";
export type MarkerUnits = "strokeWidth" | "userSpaceOnUse";
export type Orient = "auto" | "auto-start-reverse";
export type TextAnchor = "start" | "middle" | "end";
export type FontStyle = "normal" | "italic" | "oblique";
export type FontVariant = "normal" | "small-caps";
Expand Down Expand Up @@ -230,7 +232,8 @@ export type EllipseType = React.ComponentClass<EllipseProps>;
export type GProps = {
opacity?: NumberProp,
...
} & CommonPathProps;
} & CommonPathProps &
FontProps;
declare export var G: React.ComponentClass<GProps>;
export type GType = React.ComponentClass<GProps>;
export interface ForeignObjectProps {
Expand Down Expand Up @@ -430,35 +433,19 @@ export type UseProps = {
} & CommonPathProps;
declare export var Use: React.ComponentClass<UseProps>;
export type UseType = React.ComponentClass<UseProps>;
declare export var EMaskUnits: {|
+USER_SPACE_ON_USE: "userSpaceOnUse", // "userSpaceOnUse"
+OBJECT_BOUNDING_BOX: "objectBoundingBox", // "objectBoundingBox"
|};
export type TMaskUnits =
| typeof EMaskUnits.USER_SPACE_ON_USE
| typeof EMaskUnits.OBJECT_BOUNDING_BOX;
export type MaskProps = {
id?: string,
x?: NumberProp,
y?: NumberProp,
width?: NumberProp,
height?: NumberProp,
maskTransform?: ColumnMajorTransformMatrix | string,
maskUnits?: TMaskUnits,
maskContentUnits?: TMaskUnits,
maskUnits?: Units,
maskContentUnits?: Units,
...
} & CommonPathProps;
declare export var Mask: React.ComponentClass<MaskProps>;
export type MaskType = React.ComponentClass<MaskProps>;
declare export var MarkerUnits: {|
+STROKE_WIDTH: "strokeWidth", // "strokeWidth"
+USER_SPACE_ON_USE: "userSpaceOnUse", // "userSpaceOnUse"
|};

declare export var Orient: {|
+AUTO: "auto", // "auto"
+AUTO_START_REVERSE: "auto-start-reverse", // "auto-start-reverse"
|};
export interface MarkerProps {
id?: string;
viewBox?: string;
Expand All @@ -467,8 +454,8 @@ export interface MarkerProps {
refY?: NumberProp;
markerWidth?: NumberProp;
markerHeight?: NumberProp;
markerUnits?: $Values<typeof MarkerUnits>;
orient?: $Values<typeof Orient> | NumberProp;
markerUnits?: MarkerUnits;
orient?: Orient | NumberProp;
}
declare export var Marker: React.ComponentClass<MarkerProps>;
export type MarkerType = React.ComponentClass<MarkerProps>;
Expand Down