TypeScript/tests/cases/compiler/complicatedIndexesOfIntersectionsAreInferencable.ts
Wesley Wigham 9554f09d09
Add ability to infer to the simplified form of a type variable (#27953)
* Add ability to infer to the simplified form of a type variable

* Add test
2018-10-17 14:44:39 -07:00

22 lines
745 B
TypeScript

// @strict: true
interface FormikConfig<Values> {
initialValues: Values;
validate?: (props: Values) => void;
validateOnChange?: boolean;
}
declare function Func<Values = object, ExtraProps = {}>(
x: (string extends "validate" | "initialValues" | keyof ExtraProps
? Readonly<FormikConfig<Values> & ExtraProps>
: Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validate" | "initialValues" | Exclude<keyof ExtraProps, "validateOnChange">>
& Partial<Pick<Readonly<FormikConfig<Values> & ExtraProps>, "validateOnChange" | Extract<keyof ExtraProps, "validateOnChange">>>)
): void;
Func({
initialValues: {
foo: ""
},
validate: props => {
props.foo;
}
});