-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A qustion about ReadOnly #27
Comments
This causing me lot of issues too, consider this example: const obj = {foo: 1, bar: 2}
const myKeys = ['foo', 'bar'] as const;
D.selectKeys(obj, myKeys); and this produce same error as mentioned I really like this library but this is causing my lot of problems. Is really necessary for type to be mutable? I think it should work without any issue for Thanks. // edit: type Writeable<T> = { -readonly [P in keyof T]-?: T[P] };
D.selectKeys(obj, myKeys as Writeable<typeof obj>); |
@leviathan-n to use mutable arrays in the entire project, simply add the following in your declare namespace Belt {
type UseMutableArrays = 1
} although you may still want to use immutable arrays (which is a recommended approach), then starting from const xs = pipe(
items,
A.map(…),
F.toMutable,
) // → PickerColumnItem[] links: @Nodonisko your case is different, ts-belt/__tests__/Dict/selectKeys.test.ts Line 16 in 3e27328
|
@mobily Wow, thank you a lot! That significantly improves my DX :) |
Thanks for your work on this awesome library
I'm trying to replace lodash with this in my project, but not sure whether i'm using this library in a idiomatic way
sometimes components only accept mutable types, is it a right practice that manually converting result to un-readonly type by using
as
keyword?for example
when i pass a
A.map
output to the columns prop, tsc complaint that:and fix this by
as PickerColumnItem[]
The text was updated successfully, but these errors were encountered: