-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDuplicateAn existing issue was already createdAn existing issue was already createdFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.3.0-dev.20181121
Search Terms: function types, return types, inconsistent
Code
const test = { 1: '', 2: '', 3: '' };
type keys = { [key in keyof typeof test]: string };
type StateFunction<TState> = () => TState;
const a: StateFunction<keys> = () => ({ ...test, 4: '' }); //Does not error
const b = (): keys => ({ ...test, 4: '' }); //Errors properly
Expected behavior:
const a: StateFunction<keys> = () => ({ ...test, 4: '' });
Should error
Actual behavior:
const a: StateFunction<keys> = () => ({ ...test, 4: '' });
Does not error
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDuplicateAn existing issue was already createdAn existing issue was already createdFix AvailableA PR has been opened for this issueA PR has been opened for this issue