Small TS improvement - make sure result/error is typed correctly.
This commit is contained in:
parent
7db70a602d
commit
ef3ac8883e
|
@ -31,7 +31,7 @@
|
|||
import { capitalise } from "@/helpers"
|
||||
import { Utils, JsonFormatter } from "@budibase/frontend-core"
|
||||
import { licensing } from "@/stores/portal"
|
||||
import { BindingMode, EditorMode, SidePanel } from "@budibase/types"
|
||||
import { BindingMode, SidePanel } from "@budibase/types"
|
||||
import type {
|
||||
EnrichedBinding,
|
||||
BindingCompletion,
|
||||
|
@ -64,8 +64,8 @@
|
|||
let getCaretPosition: CaretPositionFn | undefined
|
||||
let insertAtPos: InsertAtPositionFn | undefined
|
||||
let targetMode: BindingMode | null = null
|
||||
let expressionResult: string | undefined | null
|
||||
let expressionError: string | undefined | null
|
||||
let expressionResult: string | undefined
|
||||
let expressionError: string | undefined
|
||||
let evaluating = false
|
||||
|
||||
$: useSnippets = allowSnippets && !$licensing.isFreePlan
|
||||
|
@ -155,7 +155,7 @@
|
|||
const debouncedEval = Utils.debounce(
|
||||
(expression: string | null, context: any, snippets: Snippet[]) => {
|
||||
try {
|
||||
expressionError = null
|
||||
expressionError = undefined
|
||||
expressionResult = processStringSync(
|
||||
expression || "",
|
||||
{
|
||||
|
@ -167,7 +167,7 @@
|
|||
}
|
||||
)
|
||||
} catch (err: any) {
|
||||
expressionResult = null
|
||||
expressionResult = undefined
|
||||
expressionError = err
|
||||
}
|
||||
evaluating = false
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
import { fade } from "svelte/transition"
|
||||
import { UserScriptError } from "@budibase/string-templates"
|
||||
|
||||
export let expressionResult
|
||||
export let expressionError
|
||||
export let expressionResult: string | undefined = undefined
|
||||
export let expressionError: string | undefined = undefined
|
||||
export let evaluating = false
|
||||
export let expression: string | null = null
|
||||
|
||||
|
|
Loading…
Reference in New Issue