-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed as not planned
Closed as not planned
Copy link
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options
Description
π Search Terms
Inference
π Version & Regression Information
- This changed between versions 5.5.4 and 5.6.0-beta (still happening in 5.6.1-rc)
β― Playground Link
π» Code
interface Foo {
type: 'foo';
optionalProp?: boolean;
}
type Consumer<
// in out // Uncommenting out this line "fixes" the issue.
T
> = (arg: T) => void;
declare function someFunc<T
extends Foo // Commenting out this line "fixes" the issue.
>(
consumer: Consumer<T>,
defaultT: T,
): T;
declare const fooConsumer: Consumer<Foo>;
const result = someFunc(fooConsumer, {type: 'foo'});
// ^?
π Actual behavior
result
is of type { type: "foo"; }
π Expected behavior
result
is of type Foo
as it was in previous releases
Additional information about the issue
See the comments in the example code for two tweaks to make for the code to work as expected. I get adding in out
changing things. I'm less clear on why removing the extends
should make any difference.
(Google note: relevant source location http://shortn/_eCS9djFiAR)
Metadata
Metadata
Assignees
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options