You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose adding a new interface (e.g., CommonProps) to the existing TypeScript structure of Page to improve both type flexibility and autocomplete functionality. The new interface will allow a clear separation between page-specific properties and globally shared ones.
By adding this new interface, we can cleanly separate these global properties from the more dynamic PageProps and SharedProps. This will make the structure cleaner and more organized.
By using TypeScript's declaration merging, the interface can be extended in .d.ts files. This enables developers to globally add project-specific properties without the need for additional middleware types or workarounds.
Here's how the interface would be added to the Page interface:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I propose adding a new interface (e.g.,
CommonProps
) to the existing TypeScript structure ofPage
to improve both type flexibility and autocomplete functionality. The new interface will allow a clear separation between page-specific properties and globally shared ones.By adding this new interface, we can cleanly separate these global properties from the more dynamic PageProps and SharedProps. This will make the structure cleaner and more organized.
By using TypeScript's declaration merging, the interface can be extended in .d.ts files. This enables developers to globally add project-specific properties without the need for additional middleware types or workarounds.
Here's how the interface would be added to the
Page
interface:In a consuming project, the interface can be extended globally using a .d.ts file:
Beta Was this translation helpful? Give feedback.
All reactions