Skip to content

Commit 4beba43

Browse files
committed
refactor: move TS types to proper modules
1 parent eda2932 commit 4beba43

File tree

7 files changed

+62
-58
lines changed

7 files changed

+62
-58
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"files.autoSave": "onFocusChange",
3-
"editor.formatOnSave": true
3+
"editor.formatOnSave": true,
4+
"typescript.tsdk": "node_modules/typescript/lib"
45
}

conferences/big-party-iv/components/schedule.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Schedule = (props: { data: SpeakerModel[] }) => {
99
width: '100',
1010
height: '100',
1111
layout: 'responsive',
12-
}
12+
} as const
1313

1414
return (
1515
<section className="schedule ngparty-conf-section">

conferences/big-party-v/faq.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const Faq = () => {
4444
<ul className="faq-content">
4545
{DATA.map((item) => {
4646
return (
47-
<li className="faq-content-item">
47+
<li className="faq-content-item" key={item.question}>
4848
<FaqItem {...item} />
4949
</li>
5050
)

globals.d.ts

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,10 @@
1-
import React from 'react'
2-
declare module 'react' {
3-
interface DOMAttributes<T> {
4-
on?: string
5-
}
6-
}
7-
8-
declare global {
9-
declare namespace JSX {
10-
interface AmpLightBox {
11-
id: string
12-
layout: 'nodisplay'
13-
}
14-
interface AmpSidebar {
15-
id: string
16-
className?: string
17-
layout: 'nodisplay'
18-
side: 'left' | 'right'
19-
}
20-
interface AmpImg {
21-
alt?: string
22-
src?: string
23-
width?: string
24-
height?: string
25-
layout?:
26-
| 'responsive'
27-
| 'fixed'
28-
| 'fill'
29-
| 'fixed-height'
30-
| 'flex-item'
31-
| 'container'
32-
| 'nodisplay'
33-
| 'intrinsic'
34-
className?: string
35-
}
36-
37-
interface AmpIframe {
38-
width?: string
39-
height?: string
40-
sandbox?: string
41-
layout?: string
42-
frameborder?: string
43-
src?: string
44-
className?: string
45-
children?: React.ReactNode
46-
}
47-
interface AmpAnalytics {}
48-
49-
interface IntrinsicElements {
50-
'amp-img': AmpImg
51-
'amp-iframe': AmpIframe
52-
'amp-analytics': AmpAnalytics
53-
'amp-sidebar': AmpSidebar
54-
'amp-lightbox': AmpLightBox
55-
}
1+
declare namespace JSX {
2+
interface IntrinsicElements {
3+
'amp-img': AMP.AmpImg
4+
'amp-iframe': AMP.AmpIframe
5+
'amp-analytics': AMP.AmpAnalytics
6+
'amp-sidebar': AMP.AmpSidebar
7+
'amp-lightbox': AMP.AmpLightBox
568
}
579
}
5810

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
],
2424
"include": [
2525
"next-env.d.ts",
26+
"typings",
2627
"**/*.ts",
2728
"**/*.tsx"
2829
]

typings/amp.d.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
declare namespace AMP {
2+
interface AmpLightBox {
3+
id: string
4+
layout: 'nodisplay'
5+
children?: React.ReactNode
6+
}
7+
interface AmpSidebar {
8+
id: string
9+
className?: string
10+
layout: 'nodisplay'
11+
side: 'left' | 'right'
12+
children?: React.ReactNode
13+
}
14+
interface AmpImg {
15+
alt?: string
16+
src?: string
17+
width?: string
18+
height?: string
19+
layout?:
20+
| 'responsive'
21+
| 'fixed'
22+
| 'fill'
23+
| 'fixed-height'
24+
| 'flex-item'
25+
| 'container'
26+
| 'nodisplay'
27+
| 'intrinsic'
28+
className?: string
29+
children?: React.ReactNode
30+
}
31+
32+
interface AmpIframe {
33+
width?: string
34+
height?: string
35+
sandbox?: string
36+
layout?: string
37+
frameborder?: string
38+
src?: string
39+
className?: string
40+
children?: React.ReactNode
41+
}
42+
interface AmpAnalytics {}
43+
}

typings/extended/react.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
declare module 'react' {
4+
interface DOMAttributes<T> {
5+
on?: string
6+
}
7+
}

0 commit comments

Comments
 (0)