Skip to content

Commit

Permalink
Merge branch 'main' into pr-3092
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown committed Dec 23, 2023
2 parents 9248af4 + 45c440f commit 4a9602c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-pugs-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/serialize': patch
---

Replace arrays with readonly arrays in CSS type definitions, following changes in `csstype`
9 changes: 9 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Security policy

## Supported versions

The latest version of the project is currently supported with security updates.

## Reporting a vulnerability

You can report a vulnerability by contacting maintainers via email.
6 changes: 4 additions & 2 deletions packages/react/types/tests-css.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ css`
// $ExpectError
css(() => 'height: 300px;')

// $ExpectError
css`
position: relative;
flexgrow: ${() => 20};
flexgrow: ${
// $ExpectError
() => 20
};
`
5 changes: 3 additions & 2 deletions packages/serialize/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ export type CSSProperties = CSS.PropertiesFallback<number | string>
export type CSSPropertiesWithMultiValues = {
[K in keyof CSSProperties]:
| CSSProperties[K]
| Array<Extract<CSSProperties[K], string>>
| ReadonlyArray<Extract<CSSProperties[K], string>>
}

export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject }

export interface ArrayCSSInterpolation extends Array<CSSInterpolation> {}
export interface ArrayCSSInterpolation
extends ReadonlyArray<CSSInterpolation> {}

export type InterpolationPrimitive =
| null
Expand Down
6 changes: 5 additions & 1 deletion packages/serialize/types/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ serializeStyles({}, {})

let cssObject: CSSObject = {
fontWeight: 400,
background: ['red'],
otherProp: ['some-value'],
':hover': {
fontWeight: 700
fontWeight: 700,
background: ['red'] as const,
otherProp: ['some-value'] as const
}
}

Expand Down

0 comments on commit 4a9602c

Please sign in to comment.