TypeScript/tests/baselines/reference/noImplicitAnyInCastExpression.errors.txt

24 lines
859 B
Plaintext
Raw Normal View History

tests/cases/compiler/noImplicitAnyInCastExpression.ts(16,2): error TS2352: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other.
Property 'a' is missing in type '{ c: null; }'.
2014-09-06 01:41:37 +02:00
==== tests/cases/compiler/noImplicitAnyInCastExpression.ts (1 errors) ====
// verify no noImplictAny errors reported with cast expression
interface IFoo {
a: number;
b: string;
}
// Expr type not assignable to target type
(<IFoo>{ a: null });
2014-09-08 21:08:15 +02:00
// Expr type assignable to target type
2014-09-06 01:41:37 +02:00
(<IFoo>{ a: 2, b: undefined });
2014-09-08 21:08:15 +02:00
// Neither types is assignable to each other
2014-09-06 01:41:37 +02:00
(<IFoo>{ c: null });
~~~~~~~~~~~~~~~~~
!!! error TS2352: Neither type '{ c: null; }' nor type 'IFoo' is assignable to the other.
!!! error TS2352: Property 'a' is missing in type '{ c: null; }'.