Closed cstrnt closed 2 years ago
This is how I'd expect the types to be inferred. If you want null
or undefined
in the types then you should explicitly type the promise or type-cast the return type of the promise to null | string
.
https://playground.solidjs.com/?hash=-313264341&version=1.4.1
You’re right, sorry for the inconvenience
Describe the bug
When using
createResource
I sometimes want to callmutate(null)
ormutate(undefined)
to optimistically remove an item. The current typescript types only allow callingmutate
withT
Your Example Website or App
https://playground.solidjs.com/?version=1.4.1#NobwRAdghgtgpmAXGGUCWEwBowBcCeADgsrgM4Ae2YZA9gK4BOAxiWGjIbY7gAQi9GcCABM4jXgF9eAM0a0YvADo1aAGzQiAtACsyAegDucAEYqA3EogcuPfr2ZCouOACU4dJqymz5ilXQa2noWVlYy9BDMuGi0ELwAwgwQLowAFACU-Fa8DnFkfMAw+O5knixwWPYw9LjOcFIAurwAvA5OLqUMFWk5ucp4HrgqWH25ma0AfLwACn5oZHAAdEKBAG5wvYMFKhmj8f0CGGgxUGoAamf0cIgDLjtgUn0ZlhB9QrhM8b0HuQA8kzG-T+ZEIUAgkxAxVK5VYmUkf30oPBgN+wJMtVwcV4cQSGmYAGsWiAJi1pjU6i40hB6Go1BlJJMALK1eqIjG4LEQoGI1G5F5WSRhCBCUTiNKk6Z-JKRVK8fSTKoiWjMejwFJLADmcFwAFE1HB1bgAEL4ACSIi2UEIhF2AEIBZhJI0gA
Steps to Reproduce the Bug or Issue
Open the solid playground with the given URL
Expected behavior
As a user I want to be able to call
mutate
withnull
orundefined
without Typescript errorsScreenshots or Videos
No response
Platform
Additional context
No response