diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c065478a20a..af5984847f7 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -411,7 +411,7 @@ namespace ts { EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions, // Parsing context flags - ContextFlags = DisallowInContext | YieldContext | DecoratorContext | AwaitContext, + ContextFlags = DisallowInContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile, // Exclude these flags when parsing a Type TypeExcludesFlags = YieldContext | AwaitContext, diff --git a/tests/cases/unittests/jsDocParsing.ts b/tests/cases/unittests/jsDocParsing.ts index 9988383b467..9c68cea3297 100644 --- a/tests/cases/unittests/jsDocParsing.ts +++ b/tests/cases/unittests/jsDocParsing.ts @@ -11,6 +11,7 @@ module ts { assert.isTrue(typeAndDiagnostics && typeAndDiagnostics.diagnostics.length === 0); let result = Utils.sourceFileToJSON(typeAndDiagnostics.jsDocTypeExpression.type); + assert.equal(result, expected); } @@ -998,7 +999,7 @@ module ts { ? JSON.parse(Utils.sourceFileToJSON(v)) : v; }, 4); - + if (result !== expected) { // Turn on a human-readable diff if (typeof require !== 'undefined') {