Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit 4e4443a

Browse files
authored
Merge branch 'master' into export-equal
2 parents e17a604 + 9947036 commit 4e4443a

9 files changed

+1358
-0
lines changed

src/ast-node-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const AST_NODE_TYPES: { [key: string]: string } = {
102102
TSAbstractMethodDefinition: 'TSAbstractMethodDefinition',
103103
TSAnyKeyword: 'TSAnyKeyword',
104104
TSArrayType: 'TSArrayType',
105+
TSAsExpression: 'TSAsExpression',
105106
TSAsyncKeyword: 'TSAsyncKeyword',
106107
TSBooleanKeyword: 'TSBooleanKeyword',
107108
TSBigIntKeyword: 'TSBigIntKeyword',

src/convert.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,6 +2674,14 @@ export default function convert(config: ConvertConfig): ESTreeNode | null {
26742674
});
26752675
break;
26762676
}
2677+
case SyntaxKind.AsExpression: {
2678+
Object.assign(result, {
2679+
type: AST_NODE_TYPES.TSAsExpression,
2680+
expression: convertChild(node.expression),
2681+
typeAnnotation: convertChildType(node.type)
2682+
});
2683+
break;
2684+
}
26772685
case SyntaxKind.InferType: {
26782686
Object.assign(result, {
26792687
type: AST_NODE_TYPES.TSInferType,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x < y as boolean;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(a as number as any) = 42;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x as any as T;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
x === 1 as number;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const foo = x as any;

tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,16 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" en
15831583

15841584
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/async-function-with-var-declaration.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
15851585

1586+
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-expression.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
1587+
1588+
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-multi.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
1589+
1590+
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-multi-assign.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
1591+
1592+
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-operator.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
1593+
1594+
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/cast-as-simple.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
1595+
15861596
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
15871597

15881598
exports[`Parse all fixtures with "errorOnTypeScriptSyntaticAndSemanticIssues" enabled fixtures/typescript/basics/class-with-definite-assignment.src.ts.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;

0 commit comments

Comments
 (0)