Skip to content

Commit 9acb30d

Browse files
committed
add tsx build checking in react-18 integration test
1 parent bb4f735 commit 9acb30d

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

packages/next/shared/lib/dynamic.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ export default function dynamic<P = {}>(
114114
// Support for passing options, eg: dynamic(import('../hello-world'), {loading: () => <p>Loading something</p>})
115115
loadableOptions = { ...loadableOptions, ...options }
116116

117-
const suspenseOptions = loadableOptions as LoadableSuspenseOptions
117+
const suspenseOptions = loadableOptions as LoadableSuspenseOptions & {
118+
loader: Loader<P>
119+
}
118120
if (!process.env.__NEXT_CONCURRENT_FEATURES) {
119121
// Error if react root is not enabled and `suspense` option is set to true
120122
if (!process.env.__NEXT_REACT_ROOT && suspenseOptions.suspense) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function TsFoo() {
2+
return <div>ts-foo</div>
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, { Suspense } from 'react'
2+
import dynamic from 'next/dynamic'
3+
4+
const DynamicFoo = dynamic(() => import('../../components/ts-foo'), {
5+
suspense: true,
6+
})
7+
8+
export default function Typing() {
9+
return (
10+
<Suspense fallback={null}>
11+
<DynamicFoo />
12+
</Suspense>
13+
)
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": false,
8+
"forceConsistentCasingInFileNames": true,
9+
"noEmit": true,
10+
"esModuleInterop": true,
11+
"module": "esnext",
12+
"moduleResolution": "node",
13+
"resolveJsonModule": true,
14+
"isolatedModules": true,
15+
"jsx": "preserve"
16+
},
17+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
18+
"exclude": ["node_modules"]
19+
}

0 commit comments

Comments
 (0)