SolidJSS
SolidJSโ€ข3y agoโ€ข
4 replies
Mr Void

Store item = undefined, causes typescript error

items[item.id] = undefined

throws:
Type 'undefined' is not assignable to type '{ ...<item props> }'.ts(2322)


How to deal with this? I wish to avoid having undefined as a type: items: { [key: string]: Item | undefined }
Was this page helpful?