mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
[@types-baseui] Style override signature (#36633)
This commit is contained in:
committed by
Armando Aguirre
parent
1301cf09e3
commit
6723deba32
@@ -110,6 +110,17 @@ const NewStyledProgressSteps = styled<ProgressStepsStyleProps, typeof StyledProg
|
||||
// Avatar
|
||||
<Avatar name='user' size='10'/>;
|
||||
<Avatar name='user' size={10}/>; // $ExpectError
|
||||
<Avatar
|
||||
name="user"
|
||||
overrides={{ Root: { style: ({ $theme }) => ({ height: $theme.sizing && $theme.sizing.scale1000 }) } }}
|
||||
/>;
|
||||
<Avatar
|
||||
name="user"
|
||||
overrides={{ Root: { style: ({ $didImageFailToLoad }) => ({ height: $didImageFailToLoad ? '0' : '10px' }) } }}
|
||||
/>;
|
||||
<Avatar name="user" overrides={{ Root: { style: ({ children }) => ({ height: children ? '10px' : '0'})} }} />;
|
||||
<Avatar name="user" overrides={{ Root: { style: ({ $theme }) => ({ height: $theme.sizing && $theme.sizing.notasize })} }} />; // $ExpectError
|
||||
<Avatar name="user" overrides={{ Root: { style: ({ $nonExistantProp }) => ({}) }}} />; // $ExpectError
|
||||
|
||||
// Block
|
||||
<Block as='h1'/>;
|
||||
|
||||
4
types/baseui/overrides.d.ts
vendored
4
types/baseui/overrides.d.ts
vendored
@@ -1,9 +1,9 @@
|
||||
type StyleOverride = object | ((props: any) => object);
|
||||
type StyleOverride<T> = object | ((props: { $theme: Theme } & React.PropsWithChildren<T>) => object);
|
||||
|
||||
interface OverrideObject<T> {
|
||||
component?: React.ComponentType<T>;
|
||||
props?: object;
|
||||
style?: StyleOverride;
|
||||
style?: StyleOverride<T>;
|
||||
}
|
||||
|
||||
type Override<T> = OverrideObject<T> | React.ComponentType<T>;
|
||||
|
||||
Reference in New Issue
Block a user