TypeScript/tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts

10 lines
264 B
TypeScript
Raw Normal View History

// @declaration: true
2016-11-25 17:32:55 +01:00
var a: object & string = ""; // error
var b: object | string = ""; // ok
var c: object & {} = 123; // error
2016-11-25 17:32:55 +01:00
a = b; // error
b = a; // ok
const foo: object & {} = {bar: 'bar'}; // ok
const bar: object & {err: string} = {bar: 'bar'}; // error