Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('with passed type', () => {
const fn = both( // $ExpectType Predicate
x => {
return x > 1
},
x => {
return x % 2 === 0
},
);
const result = fn(2) // $ExpectType boolean
result // $ExpectType boolean
});
it('no type passed', () => {
export function shardsPath(index: string): (stats: any) => Shard[] {
return R.pathOr([], [index, 'shards']);
}
export const verifyIndexShards: (shards: Shard[]) => boolean = R.pipe(
// @ts-ignore
R.filter((shard: Shard) => shard.primary),
R.all((shard: Shard) => shard.stage === 'DONE')
);
export const getRolloverFrequency = R.pathOr('monthly', ['indexSchema', 'rollover_frequency']);
type indexFn = (config?: i.IndexSchema) => boolean;
export const isSimpleIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.pipe(R.path('template'), R.isNil)
)
);
export const isTemplatedIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.propEq('template', true),
)
);
export const isTimeSeriesIndex: indexFn = R.both(
return R.pathOr([], [index, 'shards']);
}
export const verifyIndexShards: (shards: Shard[]) => boolean = R.pipe(
// @ts-ignore
R.filter((shard: Shard) => shard.primary),
R.all((shard: Shard) => shard.stage === 'DONE')
);
export const getRolloverFrequency = R.pathOr('monthly', ['indexSchema', 'rollover_frequency']);
type indexFn = (config?: i.IndexSchema) => boolean;
export const isSimpleIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.pipe(R.path('template'), R.isNil)
)
);
export const isTemplatedIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.propEq('template', true),
)
);
export const isTimeSeriesIndex: indexFn = R.both(
isTemplatedIndex,
R.propEq('timeseries', true)
export const getRolloverFrequency = R.pathOr('monthly', ['indexSchema', 'rollover_frequency']);
type indexFn = (config?: i.IndexSchema) => boolean;
export const isSimpleIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.pipe(R.path('template'), R.isNil)
)
);
export const isTemplatedIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.propEq('template', true),
)
);
export const isTimeSeriesIndex: indexFn = R.both(
isTemplatedIndex,
R.propEq('timeseries', true)
);
export function isValidClient(input: any): input is es.Client {
if (input == null) return false;
const reqKeys = [
'indices',
'index',
type indexFn = (config?: IndexSchema) => boolean;
export const isSimpleIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.pipe(
R.path(['template']),
R.isNil
)
)
);
export const isTemplatedIndex: indexFn = R.both(isNotNil, R.both(R.has('mapping'), R.propEq('template', true)));
export const isTimeSeriesIndex: indexFn = R.both(isTemplatedIndex, R.propEq('timeseries', true));
isNotNil,
R.both(
R.has('mapping'),
R.pipe(R.path('template'), R.isNil)
)
);
export const isTemplatedIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.propEq('template', true),
)
);
export const isTimeSeriesIndex: indexFn = R.both(
isTemplatedIndex,
R.propEq('timeseries', true)
);
export function isValidClient(input: any): input is es.Client {
if (input == null) return false;
const reqKeys = [
'indices',
'index',
'get',
'search',
];
return reqKeys.every((key) => input[key] != null);
}
R.all((shard: Shard) => shard.stage === 'DONE')
);
export const getRolloverFrequency = R.pathOr('monthly', ['indexSchema', 'rollover_frequency']);
type indexFn = (config?: i.IndexSchema) => boolean;
export const isSimpleIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.pipe(R.path('template'), R.isNil)
)
);
export const isTemplatedIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.propEq('template', true),
)
);
export const isTimeSeriesIndex: indexFn = R.both(
isTemplatedIndex,
R.propEq('timeseries', true)
);
export function isValidClient(input: any): input is es.Client {
if (input == null) return false;
const reqKeys = [
return true;
}
export function isValidClient(input: any): input is es.Client {
if (input == null) return false;
const reqKeys = ['indices', 'index', 'get', 'search'];
return reqKeys.every((key) => input[key] != null);
}
type indexFn = (config?: IndexSchema) => boolean;
export const isSimpleIndex: indexFn = R.both(
isNotNil,
R.both(
R.has('mapping'),
R.pipe(
R.path(['template']),
R.isNil
)
)
);
export const isTemplatedIndex: indexFn = R.both(isNotNil, R.both(R.has('mapping'), R.propEq('template', true)));
export const isTimeSeriesIndex: indexFn = R.both(isTemplatedIndex, R.propEq('timeseries', true));