Reporter |
Image may be NSFW. Clik here to view. ![]() |
---|---|
Created | Dec 27, 2018, 3:58:20 PM |
Updated | Oct 10, 2019, 12:49:46 PM |
Subsystem | TypeScript |
Assignee | Nikita Popov (poksh) |
Priority | Normal |
State | Open |
Type | Bug |
Fix version | Backlog |
Affected versions | 2018.3, 2018.2.3, 2019.3 |
Fixed In EAP | Undefined |
VsVersion | All Versions |
Branch | No branch |
The following example produces an error message with Resharper but compiles without problems with tsc:
type A = {
type: "info";
message: string;
} | {
type: "error";
error: string;
};
declare let v: A;
if ("error" in v) // If error is in v we know that v must be an "error" object
{
console.info(v.error); // so we should be able to access error here
}