Skip to content

Commit

Permalink
fix: default to any input type
Browse files Browse the repository at this point in the history
  • Loading branch information
sandros94 committed May 28, 2024
1 parent c3b4d37 commit dbf4171
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export default createConfigForNuxt({
.append({
rules: {
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
},
})
6 changes: 3 additions & 3 deletions src/runtime/composables/surreal-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { useNuxtApp, useSurrealFetch } from '#imports'
export function useSurrealDB(overrides?: Overrides) {
const { $surrealFetch, $surrealFetchOptionsOverride } = useNuxtApp()

async function sql<T>(sql: string, ovr?: Overrides) {
async function sql<T = any>(sql: string, ovr?: Overrides) {
return useSurrealFetch<T>('sql', {
...(ovr || overrides),
method: 'POST',
body: sql,
})
}

async function $sql<T = unknown[]>(sql: string, ovr?: Overrides) {
return $surrealFetch<Response<T>>('sql', {
async function $sql<T = any>(sql: string, ovr?: Overrides) {
return $surrealFetch<T>('sql', {
...$surrealFetchOptionsOverride(ovr || overrides),
method: 'POST',
body: sql,
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/composables/surreal-fetch.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { UseFetchOptions } from 'nuxt/app'
import { type MaybeRefOrGetter, ref } from 'vue'

import type { DatabasePreset, Overrides, Response } from '../types'
import type { DatabasePreset, Overrides } from '../types'
import { useFetch, useNuxtApp, useRuntimeConfig } from '#app'

export function useSurrealFetch<T>(
export function useSurrealFetch<T = any>(
endpoint: MaybeRefOrGetter<string>,
options: UseFetchOptions<Response<T>> & Overrides = {},
options: UseFetchOptions<T> & Overrides = {},
) {
const {
database,
Expand Down

0 comments on commit dbf4171

Please sign in to comment.