-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[system] Use the CustomSystemProps interface in Box Props
- Loading branch information
Showing
3 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/mui-system/test/typescript/moduleAugmentation/boxCustomSystemProps.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import * as React from 'react'; | ||
import { Box } from '@mui/system'; | ||
|
||
declare module '@mui/system' { | ||
interface CustomSystemProps { | ||
customProp?: 'customValue'; | ||
} | ||
} | ||
|
||
function CustomSystemPropsTest() { | ||
<Box customProp="customValue" />; | ||
} | ||
|
||
function InvalidCustomSystemPropsValueTest() { | ||
// @ts-expect-error otherCustomValue is not assignable to customValue | ||
<Box customProp="otherCustomValue" />; | ||
} | ||
|
||
function UndefinedCustomSystemPropsTest() { | ||
// @ts-expect-error otherCustomProp is not defined in CustomSystemProps | ||
<Box otherCustomProp="customValue" />; | ||
} |