Skip to content

Commit

Permalink
Fix TypeScript typing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Taha Azzabi committed Mar 30, 2023
1 parent 3a04229 commit a914e56
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'
// Types
import type { Ref } from 'vue'
import type { HubConnection } from '@microsoft/signalr'
/*import type { Ref } from 'vue'
import type { HubConnection } from '@microsoft/signalr'*/
// Utils
import Badger from '@/utils/Badger'
Expand All @@ -20,11 +20,7 @@ import SnackbarBase from '@/components/SnackbarBase.vue'
// In this example, it is set to 'taha-id-01' to identify the user as "Taha" (Me).
const USER_ID = import.meta.env.VITE_USER_ID
const signalR = ref<null | {
connection: Ref<HubConnection | null>
on: (eventName: string, callback: any) => void
off: (eventName: string, callback: any) => void
}>(null)
const signalR = ref<null | any>(null)
// The countMessages variable is used to keep track of the number of messages received.
const countMessages = ref(0)
Expand Down
4 changes: 2 additions & 2 deletions src/composables/useSignalR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export default async function useSignalR(userId: string) {
}
})

const on = (eventName: string, callback) => {
const on = (eventName: string, callback: (...args: any[]) => any) => {
watchEffect(() => {
if (connection.value) {
connection.value.on(eventName, callback)
}
})
}

const off = (eventName: string, callback) => {
const off = (eventName: string, callback: (...args: any[]) => void) => {
watchEffect(() => {
if (connection.value) {
connection.value.off(eventName, callback)
Expand Down
1 change: 1 addition & 0 deletions src/utils/Badger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Badger {
private faviconSize: number

constructor(private options: BadgerOptions) {
this.faviconSize = 0;
this.faviconEL = document.querySelector("link[rel$='icon']") as HTMLLinkElement
this.src = this.faviconEL.getAttribute('href') || ''
this.canvas = document.createElement('canvas')
Expand Down

1 comment on commit a914e56

@vercel
Copy link

@vercel vercel bot commented on a914e56 Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.