Skip to content

Commit

Permalink
changes style prop to Partial<StyleProps>
Browse files Browse the repository at this point in the history
for better forward compatibility support when we add
new properties with safe default values
  • Loading branch information
AnyRoad committed Oct 28, 2024
1 parent 917fd44 commit 8eded61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"rollup-jest": "^3.1.0",
"storybook": "^8.3.3",
"ts-jest": "29.1.2",
"typescript": "5.5.4"
"typescript": "5.6.3"
},
"files": [
"dist"
Expand Down
6 changes: 1 addition & 5 deletions src/DataRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ export interface ExpandableRenderProps extends CommonRenderProps {
}

function quoteString(value: string, quoted = false) {
if (!value || quoted) {
return `"${value}"`;
}

return value;
return !value || quoted ? `"${value}"` : value;
}

function ExpandableObject({
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from './styles.module.css';

export interface Props extends React.AriaAttributes {
data: Object | Array<any>;
style?: StyleProps;
style?: Partial<StyleProps>;
shouldExpandNode?: (level: number, value: any, field?: string) => boolean;
clickToExpandNode?: boolean;
}
Expand Down Expand Up @@ -68,7 +68,7 @@ export const JsonView = ({
>
<DataRender
value={data}
style={style}
style={{ ...defaultStyles, ...style }}
lastElement
level={0}
shouldExpandNode={shouldExpandNode}
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10680,7 +10680,7 @@ __metadata:
rollup-jest: ^3.1.0
storybook: ^8.3.3
ts-jest: 29.1.2
typescript: 5.5.4
typescript: 5.6.3
peerDependencies:
react: ^18.0.0
languageName: unknown
Expand Down Expand Up @@ -12325,13 +12325,13 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:5.5.4":
version: 5.5.4
resolution: "typescript@npm:5.5.4"
"typescript@npm:5.6.3":
version: 5.6.3
resolution: "typescript@npm:5.6.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: b309040f3a1cd91c68a5a58af6b9fdd4e849b8c42d837b2c2e73f9a4f96a98c4f1ed398a9aab576ee0a4748f5690cf594e6b99dbe61de7839da748c41e6d6ca8
checksum: ba302f8822777ebefb28b554105f3e074466b671e7444ec6b75dadc008a62f46f373d9e57ceced1c433756d06c8b7dc569a7eefdf3a9573122a49205ff99021a
languageName: node
linkType: hard

Expand All @@ -12345,13 +12345,13 @@ __metadata:
languageName: node
linkType: hard

"typescript@patch:typescript@5.5.4#~builtin<compat/typescript>":
version: 5.5.4
resolution: "typescript@patch:typescript@npm%3A5.5.4#~builtin<compat/typescript>::version=5.5.4&hash=f3b441"
"typescript@patch:typescript@5.6.3#~builtin<compat/typescript>":
version: 5.6.3
resolution: "typescript@patch:typescript@npm%3A5.6.3#~builtin<compat/typescript>::version=5.6.3&hash=f3b441"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: fc52962f31a5bcb716d4213bef516885e4f01f30cea797a831205fc9ef12b405a40561c40eae3127ab85ba1548e7df49df2bcdee6b84a94bfbe3a0d7eff16b14
checksum: ade87bce2363ee963eed0e4ca8a312ea02c81873ebd53609bc3f6dc0a57f6e61ad7e3fb8cbb7f7ab8b5081cbee801b023f7c4823ee70b1c447eae050e6c7622b
languageName: node
linkType: hard

Expand Down

0 comments on commit 8eded61

Please sign in to comment.