Repository: nzakas/eslint-plugin-typescript (js)
Issue: no-angle-bracket-type-assertion fails when typeAnnotation is not a reference type.
the following code throws an exception when no-angle-bracket-type-assertion is enabled

```ts
const a : number = <number>5;
```

but it works with reference types

```ts
interface A {}
const a : A = <A>{};
```

Already have a PR for this
Pull request description: fix: no-angle-bracket-type-assertion fails with non-reference types (fixes #19)
Modify to no-angle-bracket-type-assertion rule
Add more tests for the rle

Patch:
diff --git a/lib/rules/no-angle-bracket-type-assertion.js b/lib/rules/no-angle-bracket-type-assertion.js
index 988ee1e..3045fd1 100644
--- a/lib/rules/no-angle-bracket-type-assertion.js
+++ b/lib/rules/no-angle-bracket-type-assertion.js
@@ -19,17 +19,18 @@ module.exports = {
 
     create: function(context) {
 
+        var sourceCode = context.getSourceCode();
+
         //----------------------------------------------------------------------
         // Public
         //----------------------------------------------------------------------
         return {
             TSTypeAssertionExpression: function(node) {
-                const type = node.typeAnnotation.typeAnnotation.typeName.name;
                 context.report({
                     node,
                     message: "Prefer 'as {{cast}}' instead of '<{{cast}}>' when doing type assertions",
                     data: {
-                        cast: type
+                        cast: sourceCode.getText(node.typeAnnotation.typeAnnotation)
                     }
                 });
             }


Test patch:
diff --git a/tests/lib/rules/no-angle-bracket-type-assertion.js b/tests/lib/rules/no-angle-bracket-type-assertion.js
index 3603793..775ef87 100644
--- a/tests/lib/rules/no-angle-bracket-type-assertion.js
+++ b/tests/lib/rules/no-angle-bracket-type-assertion.js
@@ -31,7 +31,74 @@ class Generic<T> implements Foo {}
 
 const foo = {} as Foo<int>;
 const bar = new Generic<int>() as Foo;
-const array : Array<string> = [];
+            `,
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "const array : Array<string> = [];",
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "const array : Array<string> = [];",
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: "const a : number = 5 as number",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as number' instead of '<number>' when doing type assertions",
+                    row: 1,
+                    column: 20
+                }
+            ]
+        },
+        {
+            code: `
+const a : number = 5;
+const b : number = a as number;
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as number' instead of '<number>' when doing type assertions",
+                    row: 3,
+                    column: 20
+                }
+            ]
+        },
+        {
+            code: "const a : Array<number> = [1] as Array<number>;",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as Array<number>' instead of '<Array<number>>' when doing type assertions",
+                    row: 1,
+                    column: 27
+                }
+            ]
+        },
+        {
+            code: `
+class A {}
+class B extends A {}
+
+const b : B = new B();
+const a : A = b as A;
+            `,
+            parser: "typescript-eslint-parser"
+        },
+        {
+            code: `
+type A = {
+    num: number
+};
+
+const b = {
+    num: 5
+};
+
+const a: A = b as A;
             `,
             parser: "typescript-eslint-parser"
         }
@@ -48,7 +115,6 @@ class Generic<T> implements Foo {}
 
 const foo = <Foo>{};
 const bar = <Foo>new Generic<int>();
-const array : Array<string> = [];
             `,
             parser: "typescript-eslint-parser",
             errors: [
@@ -63,6 +129,80 @@ const array : Array<string> = [];
                     column: 13
                 },
             ]
+        },
+        {
+            code: "const a : number = <number>5",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as number' instead of '<number>' when doing type assertions",
+                    row: 1,
+                    column: 20
+                }
+            ]
+        },
+        {
+            code: `
+const a : number = 5;
+const b : number = <number>a;
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as number' instead of '<number>' when doing type assertions",
+                    row: 3,
+                    column: 20
+                }
+            ]
+        },
+        {
+            code: "const a : Array<number> = <Array<number>>[1];",
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as Array<number>' instead of '<Array<number>>' when doing type assertions",
+                    row: 1,
+                    column: 27
+                }
+            ]
+        },
+        {
+            code: `
+class A {}
+class B extends A {}
+
+const b : B = new B();
+const a : A = <A>b;
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as A' instead of '<A>' when doing type assertions",
+                    row: 6,
+                    column: 15
+                }
+            ]
+        },
+        {
+            code: `
+type A = {
+    num: number
+};
+
+const b = {
+    num: 5
+};
+
+const a: A = <A>b;
+            `,
+            parser: "typescript-eslint-parser",
+            errors: [
+                {
+                    message: "Prefer 'as A' instead of '<A>' when doing type assertions",
+                    row: 9,
+                    column: 14
+                }
+            ]
         }
     ]
 });