Different `App.PageData` for each `layout.svelte`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the problem
It would be nice if I could set App.PageData different for each layout, and then the pages inside the layout should be forced to extend that interface.
For example, a website may have a "general" layout and an "administrator" layout. I want to set the title on the layout based on the current page data. But inside the admin portal, it is different.
Describe the proposed solution
Have a way to declare the interface inside layout.svelte instead of app.d.ts
Alternatives considered
No response
Importance
nice to have
Additional Information
Related to #11779 because if I can't enforce it, it's not very useful.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with app.d.ts and layout.svelte, then read the related discussion in issue #11779. Determine how layout-specific interfaces could constrain pages inside each layout; the work is done when separate layouts can declare distinct App.PageData types and descendant pages are checked against them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100