-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: TypeScript
What problem are you facing?
I'm unable to conditionally assign fields that exist on the type. A "work around", or more specifically an alternate way of assignment, is shown in the code sample below that solves this issue. However I would like to not have to use the spread operator if I don't need to and its simply an unexpected behavior, especially since fields that don't exist the type work fine.
What driver and relevant dependency versions are you using?
Node.js driver 5.1.0
Steps to reproduce?
```ts
interface User
const update: UpdateFilter<User> = {}
update.$inc = {}
update.$inc.age = 1 // Cannot assign to 'age' because it is a read-only property.ts(2540)
update.$inc.level= 0 // Works
update.$inc = { age: 1 } // Works```