TypeScript type WriteOnlySelectorOptions<T> ?
See original GitHub issueHello ! 👋
I would like to know if the implementation of a WriteOnlySelectorOptions<T>
is planned.
I would like to use a selector to only Write and not Read values.
If this case we should have this i think :
export interface WriteOnlySelectorOptions<T> {
set: (
opts: {
set: SetRecoilState;
get: GetRecoilValue;
reset: ResetRecoilState;
},
newValue: T | DefaultValue,
) => void;
}
Currently we have only this :
export interface ReadWriteSelectorOptions<T> extends ReadOnlySelectorOptions<T> {
set: (
opts: {
set: SetRecoilState;
get: GetRecoilValue;
reset: ResetRecoilState;
},
newValue: T | DefaultValue,
) => void;
}
I get errors in the image above because i must use the get inside my selector (but for my case i don’t need it !)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Readonly - TypeScript Deep Dive - Gitbook
TypeScript's type system allows you to mark individual properties on an interface as readonly . This allows you to work in a functional...
Read more >TypeScript - ReadOnly Class Properties - TutorialsTeacher
TypeScript introduced readonly keyword which makes a property as read-only in the class, type or interface.
Read more >Documentation - Utility Types - TypeScript
Constructs a type with all properties of Type set to readonly , meaning the properties of the constructed type cannot be reassigned.
Read more >TypeScript and the ReadOnly option - Daily Dev Tips
Let's look at the readonly property in TypeScript and how we can add and remove ... It works by prefixing the type with...
Read more >Typescript creating Object Type from Readonly Array
Access each whole individual object with only [number] , then separately extract the name property (assert that it'll be the key with as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you ! Works like a charm !
Actually, you can also avoid
useRecoilCallback()
entirely: