Type PageLayout manifest type prop with PageLayoutType (#23375)
Closes #23373 `PageLayoutManifest.type` was typed as `string`, so `definePageLayout({ type: 'NOT_A_VALID_PAGE_LAYOUT_TYPE' })` compiled fine. It is now typed as `` `${PageLayoutType}` ``, which rejects arbitrary strings while keeping both forms assignable: ```ts type: PageLayoutType.STANDALONE_PAGE type: 'STANDALONE_PAGE' ``` A string enum member is assignable to its own literal type, so `` PageLayoutType | `${PageLayoutType}` `` would have been the same type as `` `${PageLayoutType}` `` alone. Going the other way (`type: PageLayoutType` on its own) is strictly narrower and would break every app manifest in `packages/twenty-apps` plus the `create-twenty-app` template, which all pass raw strings.
This commit is contained in:
@@ -2,6 +2,7 @@ import { type SyncableEntityOptions } from '@/application/syncableEntityOptionsT
|
||||
import {
|
||||
type GridPosition,
|
||||
type PageLayoutTabLayoutMode,
|
||||
type PageLayoutType,
|
||||
type PageLayoutWidgetConditionalDisplay,
|
||||
type PageLayoutWidgetUniversalConfiguration,
|
||||
} from '@/types';
|
||||
@@ -26,7 +27,7 @@ export type PageLayoutTabManifest = SyncableEntityOptions & {
|
||||
|
||||
export type PageLayoutManifest = SyncableEntityOptions & {
|
||||
name: string;
|
||||
type: string;
|
||||
type: `${PageLayoutType}`;
|
||||
objectUniversalIdentifier?: string;
|
||||
defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier?: string;
|
||||
tabs?: PageLayoutTabManifest[];
|
||||
|
||||
Reference in New Issue
Block a user