2014-09-04 23:23:57 +02:00
|
|
|
//// [noImplicitAnyInCastExpression.ts]
|
2014-09-06 01:41:37 +02:00
|
|
|
|
|
|
|
// verify no noImplictAny errors reported with cast expression
|
|
|
|
|
2014-09-04 23:23:57 +02:00
|
|
|
interface IFoo {
|
2014-09-06 01:41:37 +02:00
|
|
|
a: number;
|
|
|
|
b: string;
|
2014-09-04 23:23:57 +02:00
|
|
|
}
|
|
|
|
|
2014-09-06 01:41:37 +02:00
|
|
|
// 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-04 23:23:57 +02:00
|
|
|
|
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 });
|
2014-09-04 23:23:57 +02:00
|
|
|
|
|
|
|
//// [noImplicitAnyInCastExpression.js]
|
2014-09-06 01:41:37 +02:00
|
|
|
// verify no noImplictAny errors reported with cast expression
|
|
|
|
// Expr type not assignable to target type
|
2015-03-26 21:46:35 +01:00
|
|
|
{ a: null };
|
2014-09-08 21:08:15 +02:00
|
|
|
// Expr type assignable to target type
|
2015-03-26 21:46:35 +01:00
|
|
|
{ a: 2, b: undefined };
|
2014-09-08 21:08:15 +02:00
|
|
|
// Neither types is assignable to each other
|
2015-03-26 21:46:35 +01:00
|
|
|
{ c: null };
|