You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A member of Function.prototype can accessible from a type which is intersected with an arrow function, type argument, and nominal branding members but it's not assignable to the Function typed argument
#38497
Closed
acid-chicken opened this issue
May 12, 2020
· 1 comment
TS2345 should NOT occur (It did not happen in ver 3.8.3).
Actual outcomes:
TS2345 is raised as follows:
Argument of type 'T & { readonly [fooBrand]?: undefined; readonly [barBrand]?: undefined; } & Callable' is not assignable to parameter of type 'Function'. Type 'T & { readonly [fooBrand]?: undefined; readonly [barBrand]?: undefined; } & Callable' is missing the following properties from type 'Function': apply, call, bind, toString, and 6 more.
declareconstfooBrand: unique symboldeclareconstbarBrand: unique symboltypeCallable=(...args: readonlyany[])=>anytypeCallableXPlugin={readonly[fooBrand]?: neverreadonly[barBrand]?: never}&CallabletypeFooXPlugin={readonly[fooBrand]: 0readonly[barBrand]?: never}typeBarXPlugin={readonly[fooBrand]?: neverreadonly[barBrand]: 0}typeXPlugin=CallableXPlugin|FooXPlugin|BarXPluginfunctionisCallable(x: XPlugin): x is CallableXPlugin{returntypeofx=='function'}functionyo<TextendsXPlugin>(x: T){if(isCallable(x)){x.apply(null)// no errorReflect.apply(x,null,[]asconst)// error!}}
Output
"use strict";functionisCallable(x){returntypeofx=='function';}functionyo(x){if(isCallable(x)){x.apply(null);// no errorReflect.apply(x,null,[]);// error!}}
TypeScript Version: 3.9.2
Search Terms:
Expected behavior:
TS2345 should NOT occur (It did not happen in ver 3.8.3).
Actual outcomes:
TS2345 is raised as follows:
Related Issues:
#36696?
Code
Output
Compiler Options
Playground Link: Provided
The text was updated successfully, but these errors were encountered: