Automatically type getContext response
This commit is contained in:
parent
fa930de15e
commit
0b73f53974
|
@ -14,7 +14,6 @@
|
|||
GroupUserDatasource,
|
||||
DataFetchOptions,
|
||||
} from "@budibase/types"
|
||||
import { SDK, Component } from "../../index"
|
||||
|
||||
type ProviderDatasource = Exclude<
|
||||
DataFetchDatasource,
|
||||
|
@ -29,8 +28,8 @@
|
|||
export let paginate: boolean
|
||||
export let autoRefresh: number
|
||||
|
||||
const { styleable, Provider, ActionTypes, API } = getContext<SDK>("sdk")
|
||||
const component = getContext<Component>("component")
|
||||
const { styleable, Provider, ActionTypes, API } = getContext("sdk")
|
||||
const component = getContext("component")
|
||||
|
||||
let interval: ReturnType<typeof setInterval>
|
||||
let queryExtensions: Record<string, any> = {}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import { Utils } from "@budibase/frontend-core"
|
||||
import FormBlockWrapper from "./FormBlockWrapper.svelte"
|
||||
import { get } from "svelte/store"
|
||||
import { Component, Context, SDK } from "../../../../index"
|
||||
import { TableSchema, UIDatasource } from "@budibase/types"
|
||||
|
||||
type Field = { name: string; active: boolean }
|
||||
|
@ -34,9 +33,9 @@
|
|||
export let saveButtonLabel: boolean
|
||||
export let deleteButtonLabel: boolean
|
||||
|
||||
const { fetchDatasourceSchema, generateGoldenSample } = getContext<SDK>("sdk")
|
||||
const component = getContext<Component>("component")
|
||||
const context = getContext<Context>("context")
|
||||
const { fetchDatasourceSchema, generateGoldenSample } = getContext("sdk")
|
||||
const component = getContext("component")
|
||||
const context = getContext("context")
|
||||
|
||||
let schema: TableSchema
|
||||
|
||||
|
|
|
@ -3,15 +3,14 @@
|
|||
import { Icon } from "@budibase/bbui"
|
||||
import MissingRequiredSetting from "./MissingRequiredSetting.svelte"
|
||||
import MissingRequiredAncestor from "./MissingRequiredAncestor.svelte"
|
||||
import { Component, SDK } from "../../index"
|
||||
|
||||
export let missingRequiredSettings:
|
||||
| { key: string; label: string }[]
|
||||
| undefined
|
||||
export let missingRequiredAncestors: string[] | undefined
|
||||
|
||||
const component = getContext<Component>("component")
|
||||
const { styleable, builderStore } = getContext<SDK>("sdk")
|
||||
const component = getContext("component")
|
||||
const { styleable, builderStore } = getContext("sdk")
|
||||
|
||||
$: styles = { ...$component.styles, normal: {}, custom: null, empty: true }
|
||||
$: requiredSetting = missingRequiredSettings?.[0]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import { Component, Context, SDK } from "."
|
||||
|
||||
declare module "svelte" {
|
||||
function getContext(name: "sdk"): SDK
|
||||
function getContext(name: "component"): Component
|
||||
function getContext(name: "context"): Context
|
||||
}
|
Loading…
Reference in New Issue