More tests and also do not add index signature for json module

This commit is contained in:
Sheetal Nandi committed 2018-02-23 14:00:11 -08:00
1 parent 00b6c32a10
commit a1922fd41f
26 files changed
+479 -8

No files matched your search

+1 -1
View File
@@ -14882,7 +14882,7 @@ namespace ts {
const contextualType = getApparentTypeOfContextualType(node);
const contextualTypeHasPattern = contextualType && contextualType.pattern &&
(contextualType.pattern.kind === SyntaxKind.ObjectBindingPattern || contextualType.pattern.kind === SyntaxKind.ObjectLiteralExpression);
const isJSObjectLiteral = !contextualType && isInJavaScriptFile(node);
const isJSObjectLiteral = !contextualType && (isInJavaScriptFile(node) && !isInJsonFile(node));
let typeFlags: TypeFlags = 0;
let patternWithComputedProperties = false;
let hasComputedStringProperty = false;
+3 -1
View File
@@ -747,9 +747,11 @@ namespace ts {
switch (scriptKind) {
case ScriptKind.JS:
case ScriptKind.JSX:
case ScriptKind.JSON:
contextFlags = NodeFlags.JavaScriptFile;
break;
case ScriptKind.JSON:
contextFlags = NodeFlags.JavaScriptFile | NodeFlags.JsonFile;
break;
default:
contextFlags = NodeFlags.None;
break;
+1
View File
@@ -492,6 +492,7 @@ namespace ts {
JSDoc = 1 << 20, // If node was parsed inside jsdoc
/* @internal */ Ambient = 1 << 21, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier.
/* @internal */ InWithStatement = 1 << 22, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`)
JsonFile = 1 << 23, // If node was parsed in a Json
BlockScoped = Let | Const,
+4
View File
@@ -1432,6 +1432,10 @@ namespace ts {
return node && !!(node.flags & NodeFlags.JavaScriptFile);
}
export function isInJsonFile(node: Node | undefined): boolean {
return node && !!(node.flags & NodeFlags.JsonFile);
}
export function isInJSDoc(node: Node | undefined): boolean {
return node && !!(node.flags & NodeFlags.JSDoc);
}