'Why isn't generic assignable to default param in type typescript

I have a vue composable that uses modals of type { [key: string]: boolean }. My implement is shown below. However, I always get error as shown below the code. How can I fix this issue. Any information will be much appreciated.

export const useTable = <T extends { [key: string]: boolean }>(
  url: string,
  options: { modals: T } = {
    modals: {
      default: false,
      media: false,
    },
  }
) => {}

Error

Type 'Ref<{ default: boolean; media: boolean; }>' is not assignable to type 'T'.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source