swc/crates/swc_ecma_parser/tests/tsc/nonPrimitiveUnionIntersection.ts

10 lines
264 B
TypeScript
Raw Normal View History

// @declaration: true
var a: object & string = ""; // error
var b: object | string = ""; // ok
var c: object & {} = 123; // error
a = b; // error
b = a; // ok
const foo: object & {} = {bar: 'bar'}; // ok
const bar: object & {err: string} = {bar: 'bar'}; // error