- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.1k
 
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
Bug Report
🔎 Search Terms
generic, default, unknown, infer
#48480 looked similar, but it was talking about the type of a function parameter's default value not being inferred, whereas this ticket is about a generic parameter with a default type not being used by infer.
🕗 Version & Regression Information
I tested against v4.4.4, 4.6.3, and nightly.
⏯ Playground Link
💻 Code
function myFunc<A = number, B = string>(a: A, b: B) {
  return [a, b] as const
}
type myFuncType = typeof myFunc // <A = number, B = string>(a: A, b: B) => readonly [A, B] 
type myFuncReturnType = ReturnType< myFuncType > // readonly [unknown, unknown]🙁 Actual vs Expected behaviour
I expect the type of myFuncReturnType to be readonly [number, string], but it's actually readonly [unknown, unknown], because the default generic type was not used.
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug