Skip to content

Commit

Permalink
fix build and build-storybook errors
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamKelley committed Jul 10, 2021
1 parent 559ec7d commit f629c5e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/libs/spark-icons/defaults/templateSvgIcon.tsx
/libs/spark-icons/defaults/templateSvgIcon.js
/libs/spark-icons/src/*
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/dist
/coverage
/libs/spark-icons/defaults/templateSvgIcon.tsx
/libs/spark-icons/defaults/templateSvgIcon.js
/libs/spark-icons/src/*
2 changes: 1 addition & 1 deletion libs/spark-icons/scripts/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export async function main(options) {

const [svgPaths, template] = await Promise.all([
globAsync(path.join(options.svgDir, options.glob)),
fse.readFile(path.join(__dirname, '../defaults/templateSvgIcon.tsx'), {
fse.readFile(path.join(__dirname, '../defaults/templateSvgIcon.js'), {
encoding: 'utf8',
}),
]);
Expand Down
12 changes: 4 additions & 8 deletions libs/spark-icons/src/utils/createSvgIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import React from 'react';
import SvgIcon from '@material-ui/core/SvgIcon';
import { SvgIconProps as MuiSvgIconProps } from '@material-ui/core';

export default function createSvgIcon(
path: React.ReactNode,
displayName: string
): typeof SvgIcon {
// @ts-expect-error Parameter 'props' implicitly has an 'any' type.
const Component = (props, ref) => (
const Component = (props: MuiSvgIconProps, ref: React.ForwardedRef<SVGSVGElement>) => (
<SvgIcon ref={ref} {...props}>
{path}
</SvgIcon>
Expand All @@ -21,11 +21,7 @@ export default function createSvgIcon(
Component.displayName = `${displayName}Icon`;
}

// @ts-expect-error Property 'muiName' does not exist on type 'OverridableComponent<SvgIconTypeMap<{}, "svg">>'.
Component.muiName = SvgIcon.muiName;
Component.muiName = "SvgIcon";

// @ts-expect-error ype 'MemoExoticComponent<ForwardRefExoticComponent<Pick<any, string | number | symbol> & RefAttributes<SVGSVGElement>>>' is not assignable to type 'OverridableComponent<SvgIconTypeMap<{}, "svg">>'.
// Type 'ReactElement<any, string | JSXElementConstructor<any>> | null' is not assignable to type 'Element'.
// Type 'null' is not assignable to type 'ReactElement<any, any>'.
return React.memo(React.forwardRef(Component));
return React.memo(React.forwardRef(Component)) as typeof SvgIcon;
}
4 changes: 2 additions & 2 deletions libs/spark/stories/navbar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Template = (args: NavBarProps) => (
<Toolbar>
<PrendaMonogramDark fontSize="62px" />
<NavbarLink href="/">
<HomeDuotoneIcon fillColor="transparent" />
<HomeDuotoneIcon />
<span>Dashboard</span>
</NavbarLink>
<NavbarLink href="/" aria-current="page">
Expand All @@ -43,7 +43,7 @@ const Template = (args: NavBarProps) => (
<span>0</span>
</NavbarLink>
<UserMenu>
<UserDuotoneIcon fillColor="pink" />
<UserDuotoneIcon htmlColor="pink" color="inherit" />
</UserMenu>
</Toolbar>
</NavBar>
Expand Down

0 comments on commit f629c5e

Please sign in to comment.