Microsoft/TypeScript
GitHub ã§èŠãNo constituent of type 'Function | (T & Function)' is callable.
Open
#46,066 opened on 2021幎9æ26æ¥
BugDomain: Error MessagesEffort: DifficultHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
Bug Report
ð Search Terms
generic function union-type call-signatures
ð Version & Regression Information
- This is a crash
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about Generics
- I was unable to test this on prior versions because _______
⯠Playground Link
Playground link with relevant code
ð» Code
type Test = <T>(fn: T | Function) => void;
const test: Test = (fn) => {
return typeof fn === 'function' ? fn() : null;
};
// This expression is not callable.
// No constituent of type 'Function | (T & Function)' is callable.
ð Actual behavior
Compiler throw error: This expression is not callable. Not all constituents of type 'Function | (T & Function)' are callable.
ð Expected behavior
Compile success
because both 'Function | (T & Function)' are callable.