mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
40 lines
1.6 KiB
Plaintext
40 lines
1.6 KiB
Plaintext
castTest.ts(9,10): error TS2352: Conversion of type 'null' to type 'any[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
castTest.ts(11,9): error TS2352: Conversion of type 'null' to type '(res: number) => void' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
|
|
|
|
==== castTest.ts (2 errors) ====
|
|
var x : any = 0;
|
|
var z = <number> x;
|
|
var y = x + z;
|
|
|
|
var a = <any>0;
|
|
var b = <boolean>true;
|
|
var s = <string>"";
|
|
|
|
var ar = <any[]>null;
|
|
~~~~~~~~~~~
|
|
!!! error TS2352: Conversion of type 'null' to type 'any[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
|
|
var f = <(res : number) => void>null;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2352: Conversion of type 'null' to type '(res: number) => void' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
|
|
|
declare class Point
|
|
{
|
|
x: number;
|
|
y: number;
|
|
add(dx: number, dy: number): Point;
|
|
mult(p: Point): Point;
|
|
constructor(x: number, y: number);
|
|
}
|
|
|
|
var p_cast = <Point> ({
|
|
x: 0,
|
|
y: 0,
|
|
add: function(dx, dy) {
|
|
return new Point(this.x + dx, this.y + dy);
|
|
},
|
|
mult: function(p) { return p; }
|
|
})
|
|
|
|
|