Fix some unwanted anys

This commit is contained in:
Adria Navarro 2024-12-24 11:14:23 +01:00
parent e6cccaee6d
commit f1f2b90cfb
3 changed files with 10 additions and 9 deletions

View File

@ -131,7 +131,7 @@ export const deriveStores = (context: StoreContext): DerivedDatasourceStore => {
([$datasource, $definition]) => {
let type = $datasource?.type
if (type === "provider") {
type = $datasource.value?.datasource?.type
type = ($datasource as any).value?.datasource?.type
}
// Handle calculation views
if (type === "viewV2" && $definition?.type === ViewV2Type.CALCULATION) {
@ -196,7 +196,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
) => {
// Update local state
const originalDefinition = get(definition)
definition.set(newDefinition)
definition.set(newDefinition as any)
// Update server
if (get(config).canSaveSchema) {
@ -229,8 +229,10 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
newDefinition.schema[column].constraints = {}
}
newDefinition.schema[column].constraints.presence = { allowEmpty: false }
delete newDefinition.schema[column].default
return await saveDefinition(newDefinition)
if ("default" in newDefinition.schema[column]) {
delete newDefinition.schema[column].default
}
return await saveDefinition(newDefinition as any)
}
// Adds a schema mutation for a single field
@ -306,7 +308,7 @@ export const createActions = (context: StoreContext): ActionDatasourceStore => {
await saveDefinition({
...$definition,
schema: newSchema,
})
} as any)
resetSchemaMutations()
}

View File

@ -62,9 +62,6 @@ export type Store = BaseStore &
NonPlus.Store &
Datasource.Store & {
// TODO while typing the rest of stores
datasource: Writable<any> & { actions: any }
definition: Writable<any>
enrichedSchema: any
fetch: Writable<any>
filter: Writable<any>
inlineFilters: Writable<any>

View File

@ -1,14 +1,16 @@
import { SortOrder } from "@budibase/types"
import { SortOrder, UIFieldSchema } from "@budibase/types"
export interface UIDatasource {
type: string
id: string
tableId: string
primaryDisplay?: string
sort?: {
field: string
order?: SortOrder
}
queryUI: any // TODO
schema: Record<string, UIFieldSchema>
}
export interface UIFieldMutation {