-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolution
Milestone
Description
TypeScript Version: 3.2.2
Search Terms: generic inference {} createStructuredSelector mapped types
Code
type Selector<S, R> = (state: S) => R;
declare function createStructuredSelector<S, T>(
selectors: { [K in keyof T]: Selector<S, T[K]> },
): Selector<S, T>;
type State = { foo: number };
declare const mySelector: Selector<State, boolean>;
// Workaround: use explicit generics
// const result = createStructuredSelector<State, { mySelector: boolean }>({
// `State` generic incorrectly inferred as `{}`.
const result = createStructuredSelector({
// Unexpected type error under `strictFunctionTypes` due to bad inference (above)
mySelector,
});
result;
BenLorantfy, jeremybparagon, ilyaulyanov, zaqqaz, borispinus and 6 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolution