Skip to content

Commit

Permalink
add tsx build checking in react-18 integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Sep 2, 2021
1 parent bb4f735 commit 9acb30d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next/shared/lib/dynamic.tsx
Expand Up @@ -114,7 +114,9 @@ export default function dynamic<P = {}>(
// Support for passing options, eg: dynamic(import('../hello-world'), {loading: () => <p>Loading something</p>})
loadableOptions = { ...loadableOptions, ...options }

const suspenseOptions = loadableOptions as LoadableSuspenseOptions
const suspenseOptions = loadableOptions as LoadableSuspenseOptions & {
loader: Loader<P>
}
if (!process.env.__NEXT_CONCURRENT_FEATURES) {
// Error if react root is not enabled and `suspense` option is set to true
if (!process.env.__NEXT_REACT_ROOT && suspenseOptions.suspense) {
Expand Down
3 changes: 3 additions & 0 deletions test/integration/react-18/app/components/ts-foo.tsx
@@ -0,0 +1,3 @@
export default function TsFoo() {
return <div>ts-foo</div>
}
14 changes: 14 additions & 0 deletions test/integration/react-18/app/pages/suspense/typing.tsx
@@ -0,0 +1,14 @@
import React, { Suspense } from 'react'
import dynamic from 'next/dynamic'

const DynamicFoo = dynamic(() => import('../../components/ts-foo'), {
suspense: true,
})

export default function Typing() {
return (
<Suspense fallback={null}>
<DynamicFoo />
</Suspense>
)
}
19 changes: 19 additions & 0 deletions test/integration/react-18/app/tsconfig.json
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}

0 comments on commit 9acb30d

Please sign in to comment.