Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZQMS-461: Add generics for ModeSelector and SpecialView #4437

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ui/src/components/ModeSelector.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
<script lang="ts" generics="T extends string">
import TabList from './TabList.svelte'
import { IModeSelector } from '../utils'

export let props: IModeSelector
export let props: IModeSelector<T>

$: modeList = props.config.map((c) => {
return {
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ export function parseURL (text: string): string {
/**
* @public
*/
export interface IModeSelector {
mode: string
config: Array<[string, IntlString, object]>
export interface IModeSelector<Mode extends string = string> {
mode: Mode
config: Array<[Mode, IntlString, object]>
onChange: (_mode: string) => void
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
export let isCreationDisabled = false
export let descriptors: Array<Ref<ViewletDescriptor>> | undefined = undefined
export let baseQuery: DocumentQuery<Doc> | undefined = undefined
export let modes: IModeSelector | undefined = undefined
export let modes: IModeSelector<any> | undefined = undefined

let search = ''
let viewlet: WithLookup<Viewlet> | undefined
Expand Down
Loading