Skip to content

Commit

Permalink
Fix missing return statements (#4964)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbalint authored Feb 27, 2024
1 parent 10a9059 commit 50be04a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions editor/src/utils/value-parser-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ export interface JSXParsedValue {
export function parseJsx(_: unknown, value: unknown): ParseResult<JSXParsedValue> {
if (React.isValidElement(value)) {
const { type } = value

// if this is an html element, we want to return the tag name
if (typeof type === 'string') {
return right({
Expand Down Expand Up @@ -346,7 +345,7 @@ export function parseJsx(_: unknown, value: unknown): ParseResult<JSXParsedValue
})
}
if (originalType.hasOwnProperty('name') === true) {
right({
return right({
type: 'external-component',
name: (originalType as ComponentRendererComponent).name ?? 'JSX',
})
Expand All @@ -361,22 +360,22 @@ export function parseJsx(_: unknown, value: unknown): ParseResult<JSXParsedValue
})
}
if (type.hasOwnProperty('name')) {
right({
return right({
type: 'external-component',
name: (type as any).name ?? 'JSX',
})
}
}

if (typeof value === 'string') {
right({
return right({
type: 'string',
name: value,
})
}

if (typeof value === 'number') {
right({
return right({
type: 'number',
name: value.toString(),
})
Expand All @@ -388,6 +387,7 @@ export function parseJsx(_: unknown, value: unknown): ParseResult<JSXParsedValue
name: 'null',
})
}

return right({
type: 'unknown',
name: 'JSX',
Expand Down

0 comments on commit 50be04a

Please sign in to comment.