Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('infered input type', () => {
const x = pick('a,c', {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
x // $ExpectType Dictionary
const y = pick('a,c', {a:1,b:'1',c:3,d:4}); // $ExpectType Dictionary
y // $ExpectType Dictionary
const q = pick('a,c')({a:1,b:1,c:3,d:4}); // $ExpectType Dictionary
q // $ExpectType Dictionary
});
});
it('two types', () => {
interface Output{
a: number
c: number
}
const x = pick('a,c', {a:1,b:'2',c:3,d:4}); // $ExpectType Output
x.a // $ExpectType number
const y = pick('a,c')({a:1,b:'2',c:3,d:4}); // $ExpectType Output
y.a // $ExpectType number
});
it('one type', () => {
const x = pick(['a,c'], {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
x // $ExpectType Dictionary
const y = pick(['a,c'])({a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
y // $ExpectType Dictionary
});
});
it('infered input type', () => {
const x = pick('a,c', {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
x // $ExpectType Dictionary
const y = pick('a,c', {a:1,b:'1',c:3,d:4}); // $ExpectType Dictionary
y // $ExpectType Dictionary
const q = pick('a,c')({a:1,b:1,c:3,d:4}); // $ExpectType Dictionary
q // $ExpectType Dictionary
});
});
it('infered input type', () => {
const x = pick('a,c', {a:1,b:2,c:3,d:4}); // $ExpectType Dictionary
x // $ExpectType Dictionary
const y = pick('a,c', {a:1,b:'1',c:3,d:4}); // $ExpectType Dictionary
y // $ExpectType Dictionary
const q = pick('a,c')({a:1,b:1,c:3,d:4}); // $ExpectType Dictionary
q // $ExpectType Dictionary
});
});
const values = new Class()
const {onSnapshot, onPatch, onAction} = values
let props = extractTaggedProps(Class, PropsKey)
props = pipe(
rdMap(args => args[0]),
convertValuesToMst,
)(props)
const propKeys = Object.keys(props)
const viewKeys = Object.keys(extractTaggedProps(Class, ViewsKey))
const ownKeys = Object.getOwnPropertyNames(values)
const omitKeys = ExcludeKeys.concat(propKeys).concat(viewKeys)
const descs = getOwnPropertyDescriptors(Class.prototype)
const views = pick(viewKeys, descs)
const volatile = omit(omitKeys, pick(ownKeys, values))
const actions = {}
pipe(
filter((desc, key) => !omitKeys.includes(key)),
forEach((desc, key) => {
const {get, set, value} = desc
if (get || set) return views[key] = desc
if (is.fn(value)) return actions[key] = value
}),
)(descs)
const mstType = getMstType(Class) // es6 extending
let Model = mstType
? mstType.named(name).props(props)
: MstTypes.model(name, props)