File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -70,11 +70,25 @@ export const DittoProvider: React.FunctionComponent<DittoProviderProps> = (
70
70
const dittoHash : DittoHash = { }
71
71
const dittos : Ditto [ ] = setupReturnValue
72
72
for ( const ditto of dittos ) {
73
+ if ( ! ( ditto instanceof Ditto ) ) {
74
+ throw new Error (
75
+ // Type is `never` because correct use never reaches this point
76
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
77
+ `expected an array of Ditto instances to be returned by the setup function, but at least one element is not a Ditto instance (got ${ ditto } )` ,
78
+ )
79
+ }
73
80
dittoHash [ ditto . persistenceDirectory ] = ditto
74
81
}
75
82
setDittoHash ( dittoHash )
76
83
} else {
77
84
const ditto = setupReturnValue
85
+ if ( ! ( ditto instanceof Ditto ) ) {
86
+ throw new Error (
87
+ // Type is `never` because correct use never reaches this point
88
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
89
+ `expected a Ditto instance to be returned by the setup function, but got ${ ditto } ` ,
90
+ )
91
+ }
78
92
const dittoHash : DittoHash = { }
79
93
dittoHash [ ditto . persistenceDirectory ] = ditto
80
94
setDittoHash ( dittoHash )
You can’t perform that action at this time.
0 commit comments