deno.land / x / rambda@v9.1.1 / source / pickAll-spec.ts
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152import {pickAll} from 'rambda'
interface Input { a: string, b: number, c: number, d: number,}interface Output { a?: string, c?: number,}const input = {a: 'foo', b: 2, c: 3, d: 4}
describe('R.pickAll with array as props input', () => { it('without passing type', () => { const result = pickAll(['a', 'c'], input) result.a // $ExpectType string result.c // $ExpectType number }) it('without passing type + curry', () => { const result = pickAll(['a', 'c'])(input) result // $ExpectType unknown }) it('explicitly passing types', () => { const result = pickAll<Input, Output>(['a', 'c'], input) result.a // $ExpectType string | undefined result.c // $ExpectType number | undefined })})
describe('R.pickAll with string as props input', () => { it('without passing type', () => { const result = pickAll('a,c', input) result // $ExpectType unknown }) it('without passing type + curry', () => { const result = pickAll('a,c')(input) result // $ExpectType unknown }) it('explicitly passing types', () => { const result = pickAll<Input, Output>('a,c', input) result.a // $ExpectType string | undefined result.c // $ExpectType number | undefined }) it('explicitly passing types + curry', () => { const result = pickAll<Input, Output>('a,c')(input) result.a // $ExpectType string | undefined result.c // $ExpectType number | undefined })})
Version Info