Open
Description
Bug Report
It can't inferred right when I try to infer an empty object in function with ThisType
🔎 Search Terms
infer empty object
🕗 Version & Regression Information
- This is a crash
- This changed between versions 3.5.1 and 3.6.2
3.5.1
is work
⏯ Playground Link
Playground link with relevant code
💻 Code
type ComponentPropsOptions = {} | string[];
export function foo<propsOptions extends ComponentPropsOptions>(options: {
props: propsOptions & ThisType<void>;
}): propsOptions;
export function foo(options: any) {
return options;
}
const fail = foo({
props: {},
});
// {} | string[]
type FailType = typeof fail // can't infer to {}
const work = foo({
props: {
test: '1'
},
});
// { test: string;}
type WorkType = typeof work // it‘s work
🙁 Actual behavior
type FailType = {} | string[]
🙂 Expected behavior
type FailType = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment