Fix typings

This commit is contained in:
Adria Navarro 2025-01-07 15:33:05 +01:00
parent 090429fc56
commit dcf52b5dc9
4 changed files with 7 additions and 8 deletions

View File

@ -69,7 +69,7 @@ export const deriveStores = (context: StoreContext): ConfigDerivedStore => {
}
// Disable features for non DS+
if (!["table", "viewV2"].includes(type)) {
if (type && !["table", "viewV2"].includes(type)) {
config.canAddRows = false
config.canEditRows = false
config.canDeleteRows = false

View File

@ -74,7 +74,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => {
let schema: Record<string, UIFieldSchema> = getDatasourceSchema({
API,
datasource: get(datasource),
definition: $definition,
definition: $definition ?? undefined,
})
if (!schema) {
return null
@ -136,7 +136,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => {
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
return false
}
return ["table", "viewV2", "link"].includes(type)
return !!type && ["table", "viewV2", "link"].includes(type)
}
)
@ -186,7 +186,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
API,
datasource: get(datasource),
})
definition.set(def)
definition.set((def as any) ?? null)
}
// Saves the datasource definition

View File

@ -10,7 +10,7 @@ import UserFetch from "./UserFetch.js"
import GroupUserFetch from "./GroupUserFetch"
import CustomFetch from "./CustomFetch"
import QueryArrayFetch from "./QueryArrayFetch.js"
import { Table, UIDatasource } from "@budibase/types"
import { TableSchema, UIDatasource } from "@budibase/types"
import { APIClient } from "../api/types.js"
const DataFetchMap = {
@ -73,7 +73,7 @@ export const getDatasourceSchema = ({
}: {
API: APIClient
datasource: UIDatasource
definition: Table
definition?: { schema?: TableSchema }
}) => {
const instance = createEmptyFetchInstance({ API, datasource })
return instance?.getSchema(datasource, definition)

View File

@ -1,7 +1,6 @@
import { ViewV2 } from "@budibase/types"
import { UIFieldSchema } from "./table"
export interface UIView extends Omit<ViewV2, "type"> {
type: string
export interface UIView extends ViewV2 {
schema: Record<string, UIFieldSchema>
}