mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
22 lines
1.2 KiB
Plaintext
22 lines
1.2 KiB
Plaintext
errorMessageOnIntersectionsWithDiscriminants01.ts(8,1): error TS2322: Type 'A' is not assignable to type 'B'.
|
|
Type '{ test: true; } & { foo: 1; }' is not assignable to type 'B'.
|
|
Type '{ test: true; } & { foo: 1; }' is not assignable to type '{ test: true; } & { bar: 1; }'.
|
|
Property 'bar' is missing in type '{ test: true; } & { foo: 1; }' but required in type '{ bar: 1; }'.
|
|
|
|
|
|
==== errorMessageOnIntersectionsWithDiscriminants01.ts (1 errors) ====
|
|
export type Common = { test: true } | { test: false };
|
|
export type A = Common & { foo: 1 };
|
|
export type B = Common & { bar: 1 };
|
|
|
|
declare const a: A;
|
|
declare let b: B;
|
|
|
|
b = a;
|
|
~
|
|
!!! error TS2322: Type 'A' is not assignable to type 'B'.
|
|
!!! error TS2322: Type '{ test: true; } & { foo: 1; }' is not assignable to type 'B'.
|
|
!!! error TS2322: Type '{ test: true; } & { foo: 1; }' is not assignable to type '{ test: true; } & { bar: 1; }'.
|
|
!!! error TS2322: Property 'bar' is missing in type '{ test: true; } & { foo: 1; }' but required in type '{ bar: 1; }'.
|
|
!!! related TS2728 errorMessageOnIntersectionsWithDiscriminants01.ts:3:28: 'bar' is declared here.
|
|
|