mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add support for CSS objects to the styled-components CSS prop (#35774)
* Add support for CSS objects to the styled-components CSS prop
This is valid styled-components code, but TypeScript throws an error:
```JS
<div css={{ color: 'blue' }} />
```
* Uncomment test for objects in css prop
This commit is contained in:
parent
4412049ea6
commit
6d20eb981d
1
types/styled-components/index.d.ts
vendored
1
types/styled-components/index.d.ts
vendored
@ -510,6 +510,7 @@ export class StyleSheetManager extends React.Component<
|
||||
// ONLY string literals and inline invocations of css`` are supported, anything else crashes the plugin
|
||||
export type CSSProp<T = AnyIfEmpty<DefaultTheme>> =
|
||||
| string
|
||||
| CSSObject
|
||||
| FlattenInterpolation<ThemeProps<T>>;
|
||||
|
||||
export default styled;
|
||||
|
||||
@ -809,11 +809,7 @@ function cssProp() {
|
||||
return (
|
||||
<>
|
||||
<div css="background: blue;" />
|
||||
{/*
|
||||
For some reason $ExpectError doesn't work on this expression.
|
||||
Only strings work, objects crash the plugin.
|
||||
<div css={{ background: "blue" }} />
|
||||
*/}
|
||||
<div css={{ background: "blue" }} />
|
||||
<div
|
||||
// would be nice to be able to turn this into an error as it also crashes the plugin,
|
||||
// but this is how optional properties work in TypeScript...
|
||||
|
||||
Loading…
Reference in New Issue
Block a user