Open silviuaavram opened 4 years ago
Maybe it's a bit extreme for now so I will close it. If issue will arise in the future we can develop it then.
Hey, just letting you know that I am having issues with this. I would like to be able to pass an array of items marked with as const
into the downshift items property, but it won't let me even though it gives me better types as outputs when I have it marked as such.
I think marking them as readonly
would help a lot and I don't think it would break anything because it's technically a looser type definition.
@silviuaavram I tried to make a PR to address this just now but I don't know how to test the types. Running test:ts
seems to not return any errors even if I break the types on purpose. Is there a proper way to test type changes?
There is no automated test for the types. Just change the types in typings/index.d.ts and then check the usage.
downshift
version:node
version:npm
(oryarn
) version:Relevant code or config
What you did:
What happened:
Reproduction repository:
Problem description: Since we use items/selectedItems just for some logic and we do not tamper with them, we can mark them as read only in the TS interface.
Suggested solution: In typings.ts for useSelect, useCombobox and useMultipleSelection, use Readonly to wrap the items type.