-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into next-image-add-warning-parent-element
- Loading branch information
Showing
11 changed files
with
241 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Invalid Usage of `suspense` Option of `next/dynamic` | ||
|
||
#### Why This Error Occurred | ||
|
||
`<Suspense>` is not allowed under legacy render mode when using React older than v18. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
Remove `suspense: true` option in `next/dynamic` usages. | ||
|
||
### Useful Links | ||
|
||
- [Dynamic Import Suspense Usage](https://nextjs.org/docs/advanced-features/dynamic-import#with-suspense) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
test/integration/typescript-app-type-declarations/next-env.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
3 changes: 3 additions & 0 deletions
3
test/integration/typescript-app-type-declarations/pages/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Index() { | ||
return <div /> | ||
} |
61 changes: 61 additions & 0 deletions
61
test/integration/typescript-app-type-declarations/test/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* eslint-env jest */ | ||
|
||
import { join } from 'path' | ||
import { findPort, launchApp, killApp } from 'next-test-utils' | ||
import { promises as fs } from 'fs' | ||
|
||
jest.setTimeout(1000 * 60 * 2) | ||
|
||
const appDir = join(__dirname, '..') | ||
const appTypeDeclarations = join(appDir, 'next-env.d.ts') | ||
|
||
describe('TypeScript App Type Declarations', () => { | ||
it('should write a new next-env.d.ts if none exist', async () => { | ||
const prevContent = await fs.readFile(appTypeDeclarations, 'utf8') | ||
try { | ||
await fs.unlink(appTypeDeclarations) | ||
const appPort = await findPort() | ||
let app | ||
try { | ||
app = await launchApp(appDir, appPort, {}) | ||
const content = await fs.readFile(appTypeDeclarations, 'utf8') | ||
expect(content).toEqual(prevContent) | ||
} finally { | ||
await killApp(app) | ||
} | ||
} finally { | ||
await fs.writeFile(appTypeDeclarations, prevContent) | ||
} | ||
}) | ||
|
||
it('should overwrite next-env.d.ts if an incorrect one exists', async () => { | ||
const prevContent = await fs.readFile(appTypeDeclarations, 'utf8') | ||
try { | ||
await fs.writeFile(appTypeDeclarations, prevContent + 'modification') | ||
const appPort = await findPort() | ||
let app | ||
try { | ||
app = await launchApp(appDir, appPort, {}) | ||
const content = await fs.readFile(appTypeDeclarations, 'utf8') | ||
expect(content).toEqual(prevContent) | ||
} finally { | ||
await killApp(app) | ||
} | ||
} finally { | ||
await fs.writeFile(appTypeDeclarations, prevContent) | ||
} | ||
}) | ||
|
||
it('should not touch an existing correct next-env.d.ts', async () => { | ||
const prevStat = await fs.stat(appTypeDeclarations) | ||
const appPort = await findPort() | ||
let app | ||
try { | ||
app = await launchApp(appDir, appPort, {}) | ||
const stat = await fs.stat(appTypeDeclarations) | ||
expect(stat.mtime).toEqual(prevStat.mtime) | ||
} finally { | ||
await killApp(app) | ||
} | ||
}) | ||
}) |
21 changes: 21 additions & 0 deletions
21
test/integration/typescript-app-type-declarations/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"jsx": "preserve", | ||
"target": "es5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"incremental": true, | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["next-env.d.ts", "components", "pages"] | ||
} |