跳到主要内容

StyleXStylesWithout<>

Allow any styles except for keys defined in the provided object type. It works similarly to the Omit<> utility type.

import type {StyleXStylesWithout} from '@stylexjs/stylex';

type Props = {
// ...
style?: StyleXStylesWithout<{
position: unknown,
display: unknown,
top: unknown,
start: unknown,
end: unknown,
bottom: unknown,
border: unknown,
borderWidth: unknown,
borderBottomWidth: unknown,
borderEndWidth: unknown,
borderStartWidth: unknown,
borderTopWidth: unknown,
margin: unknown,
marginBottom: unknown,
marginEnd: unknown,
marginStart: unknown,
marginTop: unknown,
padding: unknown,
paddingBottom: unknown,
paddingEnd: unknown,
paddingStart: unknown,
paddingTop: unknown,
width: unknown,
height: unknown,
flexBasis: unknown,
overflow: unknown,
overflowX: unknown,
overflowY: unknown,
}>,
};

This type will disallow all the keys which are known to cause layout changes, but will continue to allow all other style properties.