-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
212c0f8
commit d7d84a2
Showing
2 changed files
with
51 additions
and
0 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
36 changes: 36 additions & 0 deletions
36
test/integration/app-types/src/app/type-checks/form/page.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,36 @@ | ||
import * as React from 'react' | ||
import type { Route } from 'next' | ||
import Form from 'next/form' | ||
|
||
export default function Page() { | ||
const invalidRoutes = ( | ||
<> | ||
<Form action="/wrong-link"></Form> | ||
<Form action="/blog/a?1/b"></Form> | ||
<Form action={`/blog/${'a/b/c'}`}></Form> | ||
</> | ||
) | ||
|
||
const validRoutes = ( | ||
<> | ||
<Form action="/dashboard/another"></Form> | ||
<Form action="/about"></Form> | ||
<Form action="/redirect"></Form> | ||
<Form action={`/blog/${'a/b'}`}></Form> | ||
<Form action={'/invalid' as Route}></Form> | ||
<Form | ||
action={async (formData) => { | ||
'use server' | ||
console.log('function action', formData.get('myInput')) | ||
}} | ||
></Form> | ||
</> | ||
) | ||
|
||
return ( | ||
<> | ||
{invalidRoutes} | ||
{validRoutes} | ||
</> | ||
) | ||
} |