Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
- update typings for generator "as"
- add missing return types for createComponents, flexCol
  • Loading branch information
heyjul3s committed Feb 11, 2021
1 parent 83e25b1 commit 015761f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/component-generator/src/createComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function generateComponent<
>(
base: BaseConfig<Props, AllHTMLAttributes<Element>, ThemeType>,
setting: Settings<Element>
) {
): React.FC<Props> {
return createStyledComponent<Props, ThemeType, AllHTMLAttributes<Element>>({
...base,
styles: { ...base.styles, ...setting },
Expand Down
2 changes: 1 addition & 1 deletion packages/component-generator/src/createStyledComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function createStyledComponent<

export function createStyled<Props = void, Theme = void, Attributes = void>(
config: BaseConfig<Props, Attributes, Theme>
) {
): React.FC<Props> {
return pipe(
createStyledElement,
createStyledAttributes,
Expand Down
2 changes: 1 addition & 1 deletion packages/component-generator/src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type ComponentsRecord<Dict, Props, ThemeType> = {

export type Settings<Element = HTMLDivElement> = {
[key: string]: ScalableCSS & {
as?: string;
as?: keyof JSX.IntrinsicElements;
attrs?: AllHTMLAttributes<Element>;
};
};
2 changes: 1 addition & 1 deletion packages/flex/src/FlexCol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function setGutterWidth(
: `${(gutterWidth as number) / 2}em`;
}

export function parseNumberToTwoDecimals(value: number) {
export function parseNumberToTwoDecimals(value: number): string {
return `${parseFloat(String(value)).toFixed(2)}`;
}

Expand Down

0 comments on commit 015761f

Please sign in to comment.