Skip to content

Commit 5dd4999

Browse files
authoredOct 26, 2022
Convert many examples to TypeScript (vercel#41825)
Strategized with @balazsorban44 to open one larger PR, with changes to individual examples as separate commits. For each example, I researched how multiple realworld codebases use the featured technology with TypeScript, to thoughtfully convert them by hand - nothing automated whatsoever. ## Documentation / Examples - [X] Make sure the linting passes by running `pnpm lint` - [X] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
1 parent a1072c6 commit 5dd4999

File tree

191 files changed

+1543
-758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+1543
-758
lines changed
 

‎examples/blog-with-comment/.prettierrc

-4
This file was deleted.

‎examples/blog-with-comment/components/comment/form.js ‎examples/blog-with-comment/components/comment/form.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import { useAuth0 } from '@auth0/auth0-react'
22

3-
function CommentForm({ text, setText, onSubmit }) {
3+
type CommentFormProps = {
4+
text: string
5+
setText: Function
6+
onSubmit: (e: React.FormEvent) => Promise<void>
7+
}
8+
9+
export default function CommentForm({
10+
text,
11+
setText,
12+
onSubmit,
13+
}: CommentFormProps) {
414
const { isAuthenticated, logout, loginWithPopup } = useAuth0()
515

616
return (
717
<form onSubmit={onSubmit}>
818
<textarea
919
className="flex w-full max-h-40 p-3 rounded resize-y bg-gray-200 text-gray-900 placeholder-gray-500"
10-
rows="2"
20+
rows={2}
1121
placeholder={
1222
isAuthenticated
1323
? `What are your thoughts?`
@@ -41,5 +51,3 @@ function CommentForm({ text, setText, onSubmit }) {
4151
</form>
4252
)
4353
}
44-
45-
export default CommentForm

0 commit comments

Comments
 (0)
Please sign in to comment.