The ParamlessTemplate type helper is good enough in most situations, however there are some exceptions. Namely, when declaring a function that accepts only paramless atom templates (singletons) for simplicity reasons, the types don't "just work" and require an extra cast:
function noParams<A extends AnyAtomTemplate<{ Params: [] }>>(atom: A) {
return myEcosystem.get(atom) // Error! Even though we know the params are `[]`
}
This PR fixes that. The above code will no longer error.
Description
The
ParamlessTemplate
type helper is good enough in most situations, however there are some exceptions. Namely, when declaring a function that accepts only paramless atom templates (singletons) for simplicity reasons, the types don't "just work" and require an extra cast:This PR fixes that. The above code will no longer error.
Affects
atoms, react