import { update , DELETE , deepUpdate } from '../' ; import { Option } from 'space-lift' ; update ( { a : 33 } , 'nani' ) ; update ( { a : 33 } , null ) ; update ( { a : 33 } , undefined ) ; const nullableObject = { } as { } | undefined ; update ( { a : 33 } , nullableObject ) ; update ( { a : 33 } , { b : 44 } ) ; update ( { a : 33 } , { a : '44' } ) ; update ( { a : 33 } , { a : { } } ) ; update ( { a : [ 33 ] } , { a : [ '44' ] } ) ; update ( { a : 33 } , { a : null } ) ; update ( { a : 33 } , { a : undefined } ) ; update ( { a : 33 } , { a : DELETE } ) ; update ( { a : 33 } as { a : number | null ; } , { a : DELETE } ) ; type B = { a ? : { b : number ; } ; } ; const obj = { } as B ; update ( obj , { a : update ( obj . a , { b : 44 } ) } ) ; const state = { a : { b : { c : { d : { e : [ '0' ] } } } } } ; update ( state , { a : update ( state . a , { b : update ( state . a . b , { c : update ( state . a . b . c , { d : update ( state . a . b . c . d , { e : new Date ( ) } ) } ) } ) } ) } ) ; const result = update ( { a : 33 } , { a : 44 } ) ; const daIndex = 8000 ; update ( { a : 33 } , { [ daIndex ] : 'lol' } ) ; deepUpdate < number > ( ) ; deepUpdate < { kiki : { koko : number ; } ; } > ( ) . at ( 'kiki' ) . at ( 'koko' ) . at ( 'toExponential' ) ; deepUpdate < { kiki : { koko : ( ) => number ; } ; } > ( ) . at ( 'kiki' ) . at ( 'koko' ) . at ( 'bind' ) ; deepUpdate ( [ ] ) . at ( 'join' ) . set ( 3 ) ; deepUpdate ( { hello : 10 } ) . at ( 10 ) . set ( 3 ) ; deepUpdate < { hello ? : { hi : number ; } ; } > ( ) . at ( 'hello' ) . at ( 'hi' ) ; deepUpdate < { hello ? : { hi : number ; } ; } > ( ) . at ( 'hello' ) . withDefault ( { hi : '10' } ) . at ( 'hi' ) ; deepUpdate < { a : number ; } [ ] > ( ) . at ( 10 ) . at ( 'a' ) ; deepUpdate ( { a : 10 } ) . at ( 'b' ) ; deepUpdate ( { a : 10 } ) . at ( 0 ) ; deepUpdate ( { a : 10 } ) . at ( 'a' ) . set ( '20' ) ; type Prim = string | undefined ; deepUpdate ( { a : 'aa' } as { a : Prim ; } ) . at ( 'a' ) . modify ( x => x . substr ( 0 ) ) ; const opt = Option ( { a : { b : 1 } } ) ; deepUpdate ( opt ) . at ( 'a' ) . at ( 'b' ) . set ( 10 ) ; deepUpdate ( { a : Option ( { b : 1 } ) } ) . at ( 'a' ) . at ( 0 ) ; deepUpdate ( { a : Option ( [ 1 , 2 , 3 ] ) } ) . at ( 'a' ) . at ( 'hey' ) ; deepUpdate ( { a : Option ( [ { name : 'John' } ] ) } ) . at ( 'a' ) . abortIfUndef ( ) . at ( 0 ) . at ( 'name' ) ; deepUpdate ( { a : Option ( 10 ) } ) . at ( 'a' ) . at ( 'hey' ) ; deepUpdate ( { a : 33 } ) . at ( 'a' ) . set ( DELETE ) ; deepUpdate ( { a : 33 } ) . at ( 'a' ) . delete ( ) ; deepUpdate ( { a : [ ] } ) . at ( 'a' ) . delete ( ) ; deepUpdate ( { a : { b : 33 } } ) . at ( 'a' ) . at ( 'b' ) . delete ( ) ;