File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed
Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -91,11 +91,11 @@ export type ValueType =
9191 | ' null'
9292 | ' undefined'
9393
94- export interface TreeNode {
94+ export interface TreeNode < T = any > {
9595 id: string // ID generated from the path to this node eg "[0,1,2]"
9696 index: number // Index of this node in the parent object as its values are iterated
9797 key: string // Key of this node eg "1" for an array key or "foo" for an object
98- value: any // The value mapped to this key
98+ value: T // The value mapped to this key
9999 depth: number
100100 collapsed: boolean
101101 type: ValueType
@@ -134,9 +134,8 @@ export type ValueComponent = new (...args: any) => SvelteComponentTyped<{
134134 defaultFormatter? : (val : any ) => string | undefined
135135}>
136136
137- export type Data = { [key in string | number | symbol ]: unknown } | unknown [] | Map <unknown , unknown > | Set <unknown >
138137export interface TreeViewProps {
139- data: Data // Data can be basically any non-primitive value
138+ data: object // Data can be basically any non-primitive value
140139 class? : string // Top node has 'svelte-tree-view' class by default
141140 theme? : Base16Theme
142141 showLogButton? : boolean
Original file line number Diff line number Diff line change 1414
1515 import type { Stores } from ' ./stores'
1616 import type {
17- Data ,
1817 TreeNode ,
1918 TreeViewProps ,
2019 Base16Theme ,
2120 ValueComponent ,
2221 TreeRecursionOpts
2322 } from ' ./types'
2423
25- export let data: Data ,
24+ export let data: object ,
2625 theme: Base16Theme | undefined = undefined ,
2726 showLogButton = false ,
2827 showCopyButton = false ,
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ export type ValueType =
1515 | 'null'
1616 | 'undefined'
1717
18- export interface TreeNode {
18+ export interface TreeNode < T = any > {
1919 id : string // ID generated from the path to this node eg "[0,1,2]"
2020 index : number // Index of this node in the parent object as its values are iterated
2121 key : string // Key of this node eg "1" for an array key or "foo" for an object
22- value : any // The value mapped to this key
22+ value : T // The value mapped to this key
2323 depth : number
2424 collapsed : boolean
2525 type : ValueType
@@ -58,9 +58,8 @@ export type ValueComponent = new (...args: any) => SvelteComponentTyped<{
5858 defaultFormatter ?: ( val : any ) => string | undefined
5959} >
6060
61- export type Data = { [ key in string | number | symbol ] : unknown } | unknown [ ] | Map < unknown , unknown > | Set < unknown >
6261export interface TreeViewProps {
63- data : Data // Data can be basically any non-primitive value
62+ data : object // Data can be basically any non-primitive value
6463 class ?: string // Top node has 'svelte-tree-view' class by default
6564 theme ?: Base16Theme
6665 showLogButton ?: boolean
You can’t perform that action at this time.
0 commit comments