mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
19 lines
1.4 KiB
Diff
19 lines
1.4 KiB
Diff
--- old.arrayCast.errors.txt
|
|
+++ new.arrayCast.errors.txt
|
|
@@= skipped -0, +0 lines =@@
|
|
-arrayCast.ts(3,23): error TS2352: Conversion of type '{ foo: string; }[]' to type '{ id: number; }[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
- Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.
|
|
+arrayCast.ts(3,23): error TS2353: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.
|
|
|
|
|
|
==== arrayCast.ts (1 errors) ====
|
|
@@= skipped -6, +5 lines =@@
|
|
// has type { foo: string }[], which is not assignable to { id: number }[].
|
|
<{ id: number; }[]>[{ foo: "s" }];
|
|
~~~
|
|
-!!! error TS2352: Conversion of type '{ foo: string; }[]' to type '{ id: number; }[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
-!!! error TS2352: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.
|
|
+!!! error TS2353: Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.
|
|
|
|
// Should succeed, as the {} element causes the type of the array to be {}[]
|
|
<{ id: number; }[]>[{ foo: "s" }, {}];
|