-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do thisPursuitFellowshipHelp wanted from Pursuit fellowship; others please avoid until Dec 19Help wanted from Pursuit fellowship; others please avoid until Dec 19SuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 3.2.0-dev.20181011
Search Terms: TS2367
Code
abstract class Base<T> {
get Item(): T { return null }
}
class Child extends Base<Item> {
constructor(public data: any) { super() }
}
interface Item { }
declare type Constructor<T> = new (data: any) => Base<T>
function func<T>(constructor: Constructor<T>): void {
// TS2367: This condition will always return 'false' since the types 'Constructor<T>' and 'typeof Child' have no overlap.
if (constructor === Child) {
// do something
}
new constructor(null)
}
func(Child) // No errorsExpected behavior:
Compiles without errors.
Actual behavior:
test.ts:14:9 - error TS2367: This condition will always return 'false' since the types 'Constructor<T>' and 'typeof Child' have no overlap.
14 if (constructor === Child) {
~~~~~~~~~~~~~~~~~~~~~
Related Issues: #25642
joshcomley, moccaplusplus, calarasmihail, jfbloom22, Honan and 3 more
Metadata
Metadata
Assignees
Labels
Domain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green lightHelp WantedYou can do thisYou can do thisPursuitFellowshipHelp wanted from Pursuit fellowship; others please avoid until Dec 19Help wanted from Pursuit fellowship; others please avoid until Dec 19SuggestionAn idea for TypeScriptAn idea for TypeScript