Skip to content

Commit

Permalink
feat(cli): Make scaffolded layout routing type-safe (#11542)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Sep 15, 2024
1 parent b998283 commit 4eb1fb6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changesets/11542.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- feat(cli): Make scaffolded layout routing type-safe (#11542) by @Tobbe

With this feature we now make sure only valid route names are passed as `titleTo` and `buttonTo` props to the scaffolded layout.

This also means you get helpful code completion when typing out the prop values
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Toaster } from '@redwoodjs/web/toast'

type LayoutProps = {
title: string
titleTo: string
titleTo: keyof typeof routes
buttonLabel: string
buttonTo: string
buttonTo: keyof typeof routes
children: React.ReactNode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2440,9 +2440,9 @@ import { Toaster } from '@redwoodjs/web/toast'

type LayoutProps = {
title: string
titleTo: string
titleTo: keyof typeof routes
buttonLabel: string
buttonTo: string
buttonTo: keyof typeof routes
children: React.ReactNode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,9 @@ import { Toaster } from '@redwoodjs/web/toast'

type LayoutProps = {
title: string
titleTo: string
titleTo: keyof typeof routes
buttonLabel: string
buttonTo: string
buttonTo: keyof typeof routes
children: React.ReactNode
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Toaster } from '@redwoodjs/web/toast'

type LayoutProps = {
title: string
titleTo: string
titleTo: keyof typeof routes
buttonLabel: string
buttonTo: string
buttonTo: keyof typeof routes
children: React.ReactNode
}

Expand Down

0 comments on commit 4eb1fb6

Please sign in to comment.