mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
add notifications and tests for jsx react-native es3
This commit is contained in:
@@ -14,7 +14,7 @@ namespace ts {
|
||||
// enable emit notification only if using --jsx preserve
|
||||
let previousOnEmitNode: (emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void) => void;
|
||||
let noSubstitution: boolean[];
|
||||
if (compilerOptions.jsx === JsxEmit.Preserve) {
|
||||
if (compilerOptions.jsx === JsxEmit.Preserve || compilerOptions.jsx === JsxEmit.ReactNative) {
|
||||
previousOnEmitNode = context.onEmitNode;
|
||||
context.onEmitNode = onEmitNode;
|
||||
context.enableEmitNotification(SyntaxKind.JsxOpeningElement);
|
||||
@@ -116,4 +116,4 @@ namespace ts {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [es3-jsx-preserve.tsx]
|
||||
|
||||
const React: any = null;
|
||||
|
||||
const elem = <div></div>;
|
||||
|
||||
|
||||
|
||||
//// [es3-jsx-preserve.jsx]
|
||||
var React = null;
|
||||
var elem = <div></div>;
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/es3-jsx-preserve.tsx ===
|
||||
|
||||
const React: any = null;
|
||||
>React : Symbol(React, Decl(es3-jsx-preserve.tsx, 1, 5))
|
||||
|
||||
const elem = <div></div>;
|
||||
>elem : Symbol(elem, Decl(es3-jsx-preserve.tsx, 3, 5))
|
||||
>div : Symbol(unknown)
|
||||
>div : Symbol(unknown)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/es3-jsx-preserve.tsx ===
|
||||
|
||||
const React: any = null;
|
||||
>React : any
|
||||
>null : null
|
||||
|
||||
const elem = <div></div>;
|
||||
>elem : any
|
||||
><div></div> : any
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [es3-jsx-react-native.tsx]
|
||||
|
||||
const React: any = null;
|
||||
|
||||
const elem = <div></div>;
|
||||
|
||||
|
||||
|
||||
//// [es3-jsx-react-native.js]
|
||||
var React = null;
|
||||
var elem = <div></div>;
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/es3-jsx-react-native.tsx ===
|
||||
|
||||
const React: any = null;
|
||||
>React : Symbol(React, Decl(es3-jsx-react-native.tsx, 1, 5))
|
||||
|
||||
const elem = <div></div>;
|
||||
>elem : Symbol(elem, Decl(es3-jsx-react-native.tsx, 3, 5))
|
||||
>div : Symbol(unknown)
|
||||
>div : Symbol(unknown)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/es3-jsx-react-native.tsx ===
|
||||
|
||||
const React: any = null;
|
||||
>React : any
|
||||
>null : null
|
||||
|
||||
const elem = <div></div>;
|
||||
>elem : any
|
||||
><div></div> : any
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [es3-jsx-react.tsx]
|
||||
|
||||
const React: any = null;
|
||||
|
||||
const elem = <div></div>;
|
||||
|
||||
|
||||
|
||||
//// [es3-jsx-react.js]
|
||||
var React = null;
|
||||
var elem = React.createElement("div", null);
|
||||
@@ -0,0 +1,11 @@
|
||||
=== tests/cases/compiler/es3-jsx-react.tsx ===
|
||||
|
||||
const React: any = null;
|
||||
>React : Symbol(React, Decl(es3-jsx-react.tsx, 1, 5))
|
||||
|
||||
const elem = <div></div>;
|
||||
>elem : Symbol(elem, Decl(es3-jsx-react.tsx, 3, 5))
|
||||
>div : Symbol(unknown)
|
||||
>div : Symbol(unknown)
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/compiler/es3-jsx-react.tsx ===
|
||||
|
||||
const React: any = null;
|
||||
>React : any
|
||||
>null : null
|
||||
|
||||
const elem = <div></div>;
|
||||
>elem : any
|
||||
><div></div> : any
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// @target: ES3
|
||||
// @sourcemap: false
|
||||
// @declaration: false
|
||||
// @jsx: preserve
|
||||
|
||||
const React: any = null;
|
||||
|
||||
const elem = <div></div>;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// @target: ES3
|
||||
// @sourcemap: false
|
||||
// @declaration: false
|
||||
// @jsx: react-native
|
||||
|
||||
const React: any = null;
|
||||
|
||||
const elem = <div></div>;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// @target: ES3
|
||||
// @sourcemap: false
|
||||
// @declaration: false
|
||||
// @jsx: react
|
||||
|
||||
const React: any = null;
|
||||
|
||||
const elem = <div></div>;
|
||||
|
||||
Reference in New Issue
Block a user