-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
TypeScript Version: 2.0.0
Code
interface Project { projectId: string }
interface Organization { organizationId: string }
type ProjectOrOrganization = Project | Organization
function findTask(query: ProjectOrOrganization) {
// Tasks.find(query)
}
findTask({ projectId: 'foo' })
// should work
findTask({ organizationId: 'bar' })
// should work
findTask({ projectId: 'foo', organizationId: 'bar' })
// should not work, but does
findTask()
// should not work
Expected behavior:
findTask({ projectId: 'foo', organizationId: 'bar' })
should not work
Expected behavior based on a post by @RyanCavanaugh
Actual behavior:
findTask({ projectId: 'foo', organizationId: 'bar' })
works
@RyanCavanaugh wrote a reply here which implies that or-unions work as XOR.
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code