-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 3.1.0-dev.201xxxxx
Search Terms:
Currently if we assign not assignable type to a variable, ts shows a deep 'not assignable' error with mark all not compatible fields. Even for a native objects like Array, Promise, Date etc...
But I think this is too noisily. All I want to know is that my type in not assignable to Array. Don't try to compare guts of Array with my type.
Code
type A = {a: string}
var y:A = {a: ''}
var x0: string = y; // Type 'A' is not assignable to type 'string'. -- it's ok!
var x1: A[] = y; // Property 'length' is missing in type 'A'.
var x2: Promise<A> = y; // Property 'then' is missing in type 'A'.
var x3: Date = y; // Property 'toDateString' is missing in type 'A'.
var x4: Node = y; // Property 'baseURI' is missing in type 'A'.Expected behavior:
Actual behavior:
Playground Link:
Related Issues:
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueDomain: Error MessagesThe issue relates to error messagingThe issue relates to error messagingRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneSuggestionAn idea for TypeScriptAn idea for TypeScript