Skip to content

Commit 263bec4

Browse files
committed
fix: typing/linting issue with newly introduced generics
1 parent 8230272 commit 263bec4

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

src/lib/VirtualListNew.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
2929
return result;
3030
})();
31+
32+
// this line fixes an issue with es-lint and the ItenType generic
33+
type ItemType = any;
3134
</script>
3235

3336
<script lang="ts" generics="ItemType">

src/routes/examples/events/code.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
sizingCalculator={szCalculator}
122122
onAfterScroll={(...props) => handleMessage('onAfterScroll:', props)}
123123
onVisibleRangeUpdate={(...props) => handleMessage('onVisibleRangeUpdate:', props)}>
124-
{#snippet vl_slot({ index, item, size }: VLSlotSignature)}
124+
{#snippet vl_slot({ index, item, size }: VLSlotSignature<(typeof myModel)[0]>)}
125125
<div
126126
style="border: 1px solid rgb(204, 204, 204); line-height: {size}px;"
127127
class:highlighted={index === scrollToIndex}>

src/routes/examples/horizontal/code.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</script>
88

99
<VirtualList items={myModel} style="width:100%" isHorizontal={true}>
10-
{#snippet vl_slot({ item }: VLSlotSignature)}
10+
{#snippet vl_slot({ item }: VLSlotSignature<(typeof myModel)[0]>)}
1111
<div style="border: 1px solid rgb(204, 204, 204)">
1212
{item.text}
1313
</div>

src/routes/examples/positioning/code.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
{scrollToBehaviour}
133133
sizingCalculator={szCalculator}
134134
onVisibleRangeUpdate={handleVisualRangeChange}>
135-
{#snippet vl_slot({ index, item, size }: VLSlotSignature)}
135+
{#snippet vl_slot({ index, item, size }: VLSlotSignature<(typeof myModel)[0]>)}
136136
<div
137137
style="border: 1px solid rgb(204, 204, 204); line-height: {size}px;"
138138
class:highlighted={index === scrollToIndex}>

src/routes/examples/variablesizing/code.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<h2>Horizontal</h2>
2525

2626
<VirtualList items={myModel} style="width:100%" isHorizontal={true} sizingCalculator={calculator}>
27-
{#snippet vl_slot({ index, item, size }: VLSlotSignature)}
27+
{#snippet vl_slot({ index, item, size }: VLSlotSignature<(typeof myModel)[0]>)}
2828
<div style="border: 1px solid rgb(204, 204, 204); width: {size}px;">
2929
#{index}
3030
{item.text}
@@ -35,7 +35,7 @@
3535
<h2>Vertical</h2>
3636

3737
<VirtualList items={myModel} style="height:600px" sizingCalculator={calculator}>
38-
{#snippet vl_slot({ index, item, size }: VLSlotSignature)}
38+
{#snippet vl_slot({ index, item, size }: VLSlotSignature<(typeof myModel)[0]>)}
3939
<div style="border: 1px solid rgb(204, 204, 204); line-height: {size}px;">
4040
#{index} Content:{item.text}
4141
</div>

src/routes/examples/vertical/code.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</script>
88

99
<VirtualList items={myModel} style="height:600px">
10-
{#snippet vl_slot({ item }: VLSlotSignature)}
10+
{#snippet vl_slot({ item }: VLSlotSignature<(typeof myModel)[0]>)}
1111
<div style="border: 1px solid rgb(204, 204, 204)">
1212
{item.text}
1313
</div>

0 commit comments

Comments
 (0)