Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u.constant({ banana: 1 })('foo');
/// *** freeze ***
// $ExpectType { potato: number; }
u.freeze({ potato: 1 });
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u.constant({ banana: 1 })('foo');
/// *** freeze ***
// $ExpectType { potato: number; }
u.freeze({ potato: 1 });
u({ this: 2 })(true); // UpdateReturnMap<{ this: number; }>
u({ this: 2 })({ that: 3 }); // $ExpectType object
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u.constant({ banana: 1 })('foo');
/// *** freeze ***
// $ExpectType { potato: number; }
u.freeze({ potato: 1 });
u({ this: 2 })({ that: 3 }); // $ExpectType object
u({ this: 2 })(true); // UpdateReturnMap<{ this: number; }>
u({ this: 2 })({ that: 3 }); // $ExpectType object
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u.constant({ banana: 1 })('foo');
/// *** freeze ***
// $ExpectType { potato: number; }
u.freeze({ potato: 1 });
u((i: number) => "foo" + i, "bar");
// update is object
u({ this: 2 }, true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 })(true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 }, { this: 3 }); // $ExpectType object
u({ this: 2 })({ that: 3 }); // $ExpectType object
u({ this: 2 })(true); // UpdateReturnMap<{ this: number; }>
u({ this: 2 })({ that: 3 }); // $ExpectType object
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
u((i: number) => "foo" + i, 1); // $ExpecType string
u((i: number) => "foo" + i, "bar");
// update is object
u({ this: 2 }, true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 })(true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 }, { this: 3 }); // $ExpectType object
u({ this: 2 })({ that: 3 }); // $ExpectType object
u({ this: 2 })(true); // UpdateReturnMap<{ this: number; }>
u({ this: 2 })({ that: 3 }); // $ExpectType object
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// update is object
u({ this: 2 }, true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 })(true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 }, { this: 3 }); // $ExpectType object
u({ this: 2 })({ that: 3 }); // $ExpectType object
u({ this: 2 })(true); // UpdateReturnMap<{ this: number; }>
u({ this: 2 })({ that: 3 }); // $ExpectType object
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u((i: number) => "foo" + i, 1); // $ExpecType string
u((i: number) => "foo" + i, "bar");
// update is object
u({ this: 2 }, true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 })(true); // $ExpectType UpdateReturnMap<{ this: number; }>
u({ this: 2 }, { this: 3 }); // $ExpectType object
u({ this: 2 })({ that: 3 }); // $ExpectType object
u({ this: 2 })(true); // UpdateReturnMap<{ this: number; }>
u({ this: 2 })({ that: 3 }); // $ExpectType object
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u.constant({ banana: 1 })('foo');
/// *** freeze ***
// $ExpectType { potato: number; }
u.freeze({ potato: 1 });
u.ifElse(false as boolean, { a: 1 }, { a: 2 }, { a: 3 }); // $ExpectType object
u.ifElse(false as boolean, "foo", 3, { a: 3 }); // $ExpectType 3 | "foo"
u.ifElse(false, "foo", 3, { a: 3 }); // $ExpectType 3
u.ifElse(true, "foo", 3, { a: 3 }); // $ExpectType "foo"
// *** map ***
const inc = (i:number) => i+1;
u.map(inc, [1,2,3]); // $ExpectType number[]
u.map(inc, ["potato"]); // $ExpectType number[]
u.map({a:1},{a:2}); // $ExpectType Mapped<{ a: number; }, { a: number; }>
u.omit('bar', { }); // $ExpectType object
u.omit(['bar'], { }); // $ExpectType object
u.omitBy([ 'banana' ], { } ); // $ExpectError
// *** constant ***
// $ExpectType { banana: number; }
u.constant({ banana: 1 })('foo');
/// *** freeze ***
// $ExpectType { potato: number; }
u.freeze({ potato: 1 });