Skip to content

Commit 45f255d

Browse files
Aryan JabbariAryan Jabbari
authored andcommitted
Fix highlighting for typescript files
1 parent 15039a9 commit 45f255d

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/pages/examples/hocs.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Please note that this section uses the `utility-types` [package](https://github.
2020

2121
HOCs often inject props into wrapped components. In the below example, `T` is defined as the `WrappedComponent` props together with the
2222

23-
```tsx
23+
```typescript
2424
import { ComponentType } from 'react';
2525
import { Diff } from 'utility-types';
2626

@@ -36,7 +36,7 @@ export default function withWoofString<T extends WithWoofStringProps>(
3636
// note below that Diff removes the props from T that exist in WithWoofStringProps
3737
// this leaves us with the props of the originally passed in component (without the injected props)
3838
const hocComponent = (props: Diff<T, WithWoofStringProps>) => (
39-
<WrappedComponent {...props as T} woof={woof} />
39+
<WrappedComponent {...(props as T)} woof={woof} />
4040
);
4141
return hocComponent;
4242
}

src/pages/examples/react-router.mdx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ import SEO from '../../components/Seo';
99
<SEO
1010
description="Using TypeScript with React Router."
1111
title="React Router"
12-
keywords={[
13-
'react router',
14-
'router',
15-
'withRouter',
16-
'url parameters',
17-
'route parameters',
18-
]}
12+
keywords={['react router', 'router', 'withRouter', 'url parameters', 'route parameters']}
1913
/>
2014

2115
# React Router
@@ -42,7 +36,7 @@ export default withRouter(SomeComponent);
4236

4337
To type URL parameters, import and use `RouteComponentProps` ([declaration](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/index.d.ts#L71)) from `react-router`. Pass your parameter definitions as a type variable to `RouteComponentProps`:
4438

45-
```tsx
39+
```typescript
4640
// Router.tsx
4741
import { BrowserRouter, Route } from 'react-router-dom';
4842

0 commit comments

Comments
 (0)