Merge branch 'react-factory-option' of https://github.com/rwyborn/TypeScript into rwyborn-react-factory-option

Conflicts:
	src/compiler/checker.ts
This commit is contained in:
Mohamed Hegazy 2016-01-07 13:50:03 -08:00
commit c0b28a3a40
5 changed files with 13 additions and 2 deletions

View file

@ -8363,7 +8363,8 @@ namespace ts {
// The symbol 'React' should be marked as 'used' so we don't incorrectly elide its import. And if there
// is no 'React' symbol in scope when targeting React emit, we should issue an error.
const reactRefErr = compilerOptions.jsx === JsxEmit.React ? Diagnostics.Cannot_find_name_0 : undefined;
const reactSym = resolveName(node.tagName, "React", SymbolFlags.Value, reactRefErr, "React");
const jsxNamespace = compilerOptions.jsxNamespace ? compilerOptions.jsxNamespace : "React";
const reactSym = resolveName(node.tagName, jsxNamespace, SymbolFlags.Value, reactRefErr, jsxNamespace);
if (reactSym) {
getSymbolLinks(reactSym).referenced = true;
}

View file

@ -54,6 +54,11 @@ namespace ts {
description: Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,
error: Diagnostics.Argument_for_jsx_must_be_preserve_or_react
},
{
name: "jsxNamespace",
type: "string",
description: Diagnostics.Specify_JSX_emit_namespace_when_JSX_code_generation_mode_is_react
},
{
name: "listFiles",
type: "boolean",

View file

@ -2393,6 +2393,10 @@
"category": "Message",
"code": 6083
},
"Specify JSX emit namespace when JSX code generation mode is 'react'": {
"category": "Message",
"code": 6084
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",

View file

@ -1186,7 +1186,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitJsxElement(openingNode: JsxOpeningLikeElement, children?: JsxChild[]) {
const syntheticReactRef = <Identifier>createSynthesizedNode(SyntaxKind.Identifier);
syntheticReactRef.text = "React";
syntheticReactRef.text = compilerOptions.jsxNamespace ? compilerOptions.jsxNamespace : "React";
syntheticReactRef.parent = openingNode;
// Call React.createElement(tag, ...

View file

@ -2382,6 +2382,7 @@ namespace ts {
inlineSourceMap?: boolean;
inlineSources?: boolean;
jsx?: JsxEmit;
jsxNamespace? : string;
listFiles?: boolean;
locale?: string;
mapRoot?: string;