Skip to content

Commit f9dcc53

Browse files
fix(types): ease style param typing (#1)
1 parent ee5c96b commit f9dcc53

File tree

25 files changed

+57
-50
lines changed

25 files changed

+57
-50
lines changed

packages/layout/src/types/canvas.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as P from '@react-pdf/primitives';
2-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
2+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
3+
34
import { YogaNode } from 'yoga-layout/load';
45

56
import { Box, NodeProps, Origin } from './base';
@@ -15,7 +16,7 @@ interface CanvasProps extends NodeProps {
1516
export type CanvasNode = {
1617
type: typeof P.Canvas;
1718
props: CanvasProps;
18-
style?: Style | Style[];
19+
style?: StyleProp<Style | Style[]>;
1920
box?: Box;
2021
origin?: Origin;
2122
yogaNode?: YogaNode;

packages/layout/src/types/checkbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as P from '@react-pdf/primitives';
2-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
2+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
33
import { YogaNode } from 'yoga-layout/load';
44

55
import { Box, FormCommonProps, Origin } from './base';
@@ -16,7 +16,7 @@ interface CheckboxProps extends FormCommonProps {
1616
export type CheckboxNode = {
1717
type: typeof P.Checkbox;
1818
props: CheckboxProps;
19-
style?: Style | Style[];
19+
style?: StyleProp<Style | Style[]>;
2020
box?: Box;
2121
origin?: Origin;
2222
yogaNode?: YogaNode;

packages/layout/src/types/circle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as P from '@react-pdf/primitives';
2-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
2+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
33

44
import {
55
Origin,
@@ -24,7 +24,7 @@ interface SafeCircleProps extends SafeSVGPresentationAttributes {
2424
export type CircleNode = {
2525
type: typeof P.Circle;
2626
props: CircleProps;
27-
style?: Style | Style[];
27+
style?: StyleProp<Style | Style[]>;
2828
box?: never;
2929
origin?: Origin;
3030
yogaNode?: never;

packages/layout/src/types/document.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as P from '@react-pdf/primitives';
22

33
import { PageNode, SafePageNode } from './page';
44
import { YogaInstance } from './base';
5-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
5+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
66

77
export type PDFVersion = '1.3' | '1.4' | '1.5' | '1.6' | '1.7' | '1.7ext3';
88

@@ -48,7 +48,7 @@ export type DocumentNode = {
4848
props: DocumentProps;
4949
box?: never;
5050
origin?: never;
51-
style?: Style | Style[];
51+
style?: StyleProp<Style | Style[]>;
5252
yoga?: YogaInstance;
5353
yogaNode?: never;
5454
children: PageNode[];

packages/layout/src/types/ellipse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as P from '@react-pdf/primitives';
2-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
2+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
33

44
import {
55
SafeSVGPresentationAttributes,
@@ -25,7 +25,7 @@ interface SafeEllipseProps extends SafeSVGPresentationAttributes {
2525
export type EllipseNode = {
2626
type: typeof P.Ellipse;
2727
props: EllipseProps;
28-
style?: Style | Style[];
28+
style?: StyleProp<Style | Style[]>;
2929
box?: never;
3030
origin?: never;
3131
yogaNode?: never;

packages/layout/src/types/field-set.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as P from '@react-pdf/primitives';
2-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
2+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
33
import { YogaNode } from 'yoga-layout/load';
44

55
import { Box, NodeProps, Origin } from './base';
@@ -14,7 +14,7 @@ interface FieldSetProps extends NodeProps {
1414
export type FieldSetNode = {
1515
type: typeof P.FieldSet;
1616
props: FieldSetProps;
17-
style?: Style | Style[];
17+
style?: StyleProp<Style | Style[]>;
1818
box?: Box;
1919
origin?: Origin;
2020
yogaNode?: YogaNode;

packages/layout/src/types/g.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
1+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
22
import * as P from '@react-pdf/primitives';
33

44
import { LineNode, SafeLineNode } from './line';
@@ -17,7 +17,7 @@ import {
1717
} from './base';
1818

1919
interface GProps extends SVGPresentationAttributes {
20-
style?: Style | Style[];
20+
style?: StyleProp<Style | Style[]>;
2121
}
2222

2323
interface SafeGProps extends SafeSVGPresentationAttributes {
@@ -27,7 +27,7 @@ interface SafeGProps extends SafeSVGPresentationAttributes {
2727
export type GNode = {
2828
type: typeof P.G;
2929
props: GProps;
30-
style?: Style | Style[];
30+
style?: StyleProp<Style | Style[]>;
3131
box?: never;
3232
origin?: never;
3333
yogaNode?: never;

packages/layout/src/types/image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
1+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
22
import * as P from '@react-pdf/primitives';
33
import { YogaNode } from 'yoga-layout/load';
44

@@ -65,7 +65,7 @@ export type ImageNode = {
6565
type: typeof P.Image;
6666
props: ImageProps;
6767
image?: Image;
68-
style?: Style | Style[];
68+
style?: StyleProp<Style | Style[]>;
6969
box?: Box;
7070
origin?: Origin;
7171
yogaNode?: YogaNode;

packages/layout/src/types/line.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as P from '@react-pdf/primitives';
2-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
2+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
33

44
import {
55
SVGPresentationAttributes,
@@ -25,7 +25,7 @@ interface SafeLineProps extends SafeSVGPresentationAttributes {
2525
export type LineNode = {
2626
type: typeof P.Line;
2727
props: LineProps;
28-
style?: Style | Style[];
28+
style?: StyleProp<Style | Style[]>;
2929
box?: never;
3030
origin?: never;
3131
yogaNode?: never;

packages/layout/src/types/link.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SafeStyle, Style } from '@react-pdf/stylesheet';
1+
import { SafeStyle, Style, StyleProp } from '@react-pdf/stylesheet';
22
import * as P from '@react-pdf/primitives';
33
import { YogaNode } from 'yoga-layout/load';
44

@@ -22,7 +22,7 @@ interface LinkProps extends NodeProps {
2222
export type LinkNode = {
2323
type: typeof P.Link;
2424
props: LinkProps;
25-
style?: Style | Style[];
25+
style?: StyleProp<Style | Style[]>;
2626
box?: Box;
2727
origin?: Origin;
2828
yogaNode?: YogaNode;

0 commit comments

Comments
 (0)