Skip to content

Commit 549dc3a

Browse files
authored
Merge pull request #182 from calibreapp/types
🔨 Improve typing
2 parents 671fffe + 31d482e commit 549dc3a

24 files changed

Lines changed: 3385 additions & 260 deletions

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
},
1818
"prettier": {
1919
"semi": false,
20-
"singleQuote": true
20+
"singleQuote": true,
21+
"trailingComma": "none",
22+
"arrowParens": "avoid"
2123
},
2224
"keywords": [
2325
"performance",

src/components/HelpScout/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ const getIcon = (icon: HelpScoutIcon): JSX.Element => {
160160
interface Props {
161161
color?: string
162162
icon?: HelpScoutIcon
163-
zIndex: string
164-
horizontalPosition: 'left' | 'right'
163+
zIndex?: string
164+
horizontalPosition?: 'left' | 'right'
165165
}
166166

167167
const HelpScout = ({

src/components/LiveChatLoaderProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { LiveChatLoaderContext } from '../context'
55

66
interface LiveChatLoaderProps {
77
provider: Provider
8-
children: JSX.Element
8+
children: React.ReactNode
99
idlePeriod?: number
1010
providerKey: string
1111
appID?: string
1212
baseUrl?: string
13+
// locale is only relevant to certain providers, e.g. Messenger and Chatwoot
14+
locale?: string
1315
beforeInit?: () => void
1416
onReady?: () => void
1517
}

src/components/Messenger/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { CSSProperties, memo } from 'react'
22

3-
import { Provider } from '../../types'
43
import useProvider from '../../hooks/useProvider'
54
import useChat from '../../hooks/useChat'
65

@@ -26,7 +25,6 @@ const styles: CSSProperties = {
2625
}
2726

2827
interface Props {
29-
providerKey: Provider | undefined
3028
themeColor?: string
3129
loggedInGreeting?: string
3230
loggedOutGreeting?: string
@@ -38,6 +36,10 @@ interface Props {
3836
color?: string
3937
}
4038

39+
interface ChatProps extends Props {
40+
providerKey: string
41+
}
42+
4143
// eslint-disable-next-line react/display-name
4244
const CustomerChat = memo(
4345
({
@@ -47,7 +49,7 @@ const CustomerChat = memo(
4749
loggedOutGreeting,
4850
greetingDialogDisplay,
4951
greetingDialogDelay
50-
}: Props) => {
52+
}: ChatProps) => {
5153
const fields = {
5254
page_id: providerKey,
5355
theme_color: color,

website/.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": [
3+
"next"
4+
],
5+
"settings": {
6+
"next": {
7+
"rootDir": "website/"
8+
}
9+
}
10+
}

website/layouts/main.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@ export default ({ title, children }) => (
77
<meta name="title" content={title} />
88
<meta name="viewport" content="width=device-width, initial-scale=1" />
99
<meta charSet="utf-8" />
10-
<link rel="icon" href="/static/favicon.ico" />
11-
<link color="#3b97d3" href="/static/spade.svg" rel="mask-icon" />
10+
<link rel="icon" href="/favicon.ico" />
11+
<link color="#3b97d3" href="/spade.svg" rel="mask-icon" />
1212
<link
1313
rel="apple-touch-icon"
1414
type="image/png"
15-
href="/static/apple-touch-icon-76-76.png"
15+
href="/apple-touch-icon-76-76.png"
1616
sizes="76x76"
1717
/>
1818
<link
1919
rel="apple-touch-icon"
2020
type="image/png"
21-
href="/static/apple-touch-icon-120-120.png"
21+
href="/apple-touch-icon-120-120.png"
2222
sizes="120x120"
2323
/>
2424
<link
2525
rel="apple-touch-icon"
2626
type="image/png"
27-
href="/static/apple-touch-icon-152-152.png"
27+
href="/apple-touch-icon-152-152.png"
2828
sizes="152x152"
2929
/>
3030
<link
3131
rel="apple-touch-icon"
3232
type="image/png"
33-
href="/static/apple-touch-icon-167-167.png"
33+
href="/apple-touch-icon-167-167.png"
3434
sizes="167x167"
3535
/>
3636
<link
3737
rel="apple-touch-icon"
3838
type="image/png"
39-
href="/static/apple-touch-icon-180-180.png"
39+
href="/apple-touch-icon-180-180.png"
4040
sizes="180x180"
4141
/>
4242
</Head>

website/next-env.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

0 commit comments

Comments
 (0)