Skip to content

Commit

Permalink
fix: fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Nov 18, 2023
1 parent c99da5c commit f2f3ba8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/components/mdx/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Highlight, themes } from "prism-react-renderer";
import {Highlight, themes} from "prism-react-renderer";
import styled from "styled-components";
import { ReactElement } from "react";

export default function CodeBlock(props: { children: ReactElement }) {
const className = props.children.props.className || "";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export default function CodeBlock(props: any) {
const className = props.children?.props.className || "";
const matches = className.match(/language-(?<lang>.*)/);
return (
<Highlight
theme={themes.oceanicNext}
code={props.children.props.children}
code={props.children?.props.children}
language={
matches && matches.groups && matches.groups.lang
? matches.groups.lang
Expand Down
8 changes: 4 additions & 4 deletions src/styles/theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css, CSSProp, DefaultTheme } from "styled-components";
import { css, CSSProp, DefaultTheme, RuleSet } from "styled-components";

declare module "styled-components" {
export interface DefaultTheme {
Expand Down Expand Up @@ -66,7 +66,7 @@ const dark: ColorPreset = {
...primary,
};

const defaultTheme: Omit<DefaultTheme, "colors"> = {
const defaultTheme = {
fontSizes: {
tiny: "12px",
s: "14px",
Expand All @@ -90,12 +90,12 @@ const defaultTheme: Omit<DefaultTheme, "colors"> = {
code: 1.6,
},
media: {
mobile: (...args) => css`
mobile: (...args: RuleSet<object>) => css`
@media only screen and (max-width: 800px) {
${args}
}
`,
desktop: (...args) => css`
desktop: (...args: RuleSet<object>) => css`
@media only screen and (min-width: 800px) {
${args}
}
Expand Down

0 comments on commit f2f3ba8

Please sign in to comment.