TypeScript/tests/baselines/reference/noImplicitAnyInCastExpression.js

27 lines
650 B
TypeScript
Raw Normal View History

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