mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Correctly identify JSX expressions as identifier parents
This commit is contained in:
parent
32bec3b3e7
commit
fc9b10eeb6
@ -1425,6 +1425,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.JsxSelfClosingElement:
|
||||
case SyntaxKind.JsxOpeningElement:
|
||||
case SyntaxKind.JsxExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
|
||||
20
tests/baselines/reference/tsxExternalModuleEmit2.js
Normal file
20
tests/baselines/reference/tsxExternalModuleEmit2.js
Normal file
@ -0,0 +1,20 @@
|
||||
//// [tests/cases/conformance/jsx/tsxExternalModuleEmit2.tsx] ////
|
||||
|
||||
//// [modules.d.ts]
|
||||
|
||||
declare module 'mod' {
|
||||
var y: any;
|
||||
export default y;
|
||||
}
|
||||
|
||||
//// [app.tsx]
|
||||
import Main from 'mod';
|
||||
declare var Foo, React;
|
||||
// Should see mod_1['default'] in emit here
|
||||
<Foo handler={Main}></Foo>
|
||||
|
||||
|
||||
//// [app.js]
|
||||
var mod_1 = require('mod');
|
||||
// Should see mod_1['default'] in emit here
|
||||
React.createElement(Foo, {"handler": mod_1["default"]});
|
||||
23
tests/baselines/reference/tsxExternalModuleEmit2.symbols
Normal file
23
tests/baselines/reference/tsxExternalModuleEmit2.symbols
Normal file
@ -0,0 +1,23 @@
|
||||
=== tests/cases/conformance/jsx/modules.d.ts ===
|
||||
|
||||
declare module 'mod' {
|
||||
var y: any;
|
||||
>y : Symbol(y, Decl(modules.d.ts, 2, 5))
|
||||
|
||||
export default y;
|
||||
>y : Symbol(y, Decl(modules.d.ts, 2, 5))
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/jsx/app.tsx ===
|
||||
import Main from 'mod';
|
||||
>Main : Symbol(Main, Decl(app.tsx, 0, 6))
|
||||
|
||||
declare var Foo, React;
|
||||
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
|
||||
>React : Symbol(React, Decl(app.tsx, 1, 16))
|
||||
|
||||
// Should see mod_1['default'] in emit here
|
||||
<Foo handler={Main}></Foo>
|
||||
>Foo : Symbol(Foo, Decl(app.tsx, 1, 11))
|
||||
>handler : Symbol(unknown)
|
||||
|
||||
26
tests/baselines/reference/tsxExternalModuleEmit2.types
Normal file
26
tests/baselines/reference/tsxExternalModuleEmit2.types
Normal file
@ -0,0 +1,26 @@
|
||||
=== tests/cases/conformance/jsx/modules.d.ts ===
|
||||
|
||||
declare module 'mod' {
|
||||
var y: any;
|
||||
>y : any
|
||||
|
||||
export default y;
|
||||
>y : any
|
||||
}
|
||||
|
||||
=== tests/cases/conformance/jsx/app.tsx ===
|
||||
import Main from 'mod';
|
||||
>Main : any
|
||||
|
||||
declare var Foo, React;
|
||||
>Foo : any
|
||||
>React : any
|
||||
|
||||
// Should see mod_1['default'] in emit here
|
||||
<Foo handler={Main}></Foo>
|
||||
><Foo handler={Main}></Foo> : any
|
||||
>Foo : any
|
||||
>handler : any
|
||||
>Main : any
|
||||
>Foo : any
|
||||
|
||||
14
tests/cases/conformance/jsx/tsxExternalModuleEmit2.tsx
Normal file
14
tests/cases/conformance/jsx/tsxExternalModuleEmit2.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
//@jsx: react
|
||||
//@module: commonjs
|
||||
|
||||
//@filename: modules.d.ts
|
||||
declare module 'mod' {
|
||||
var y: any;
|
||||
export default y;
|
||||
}
|
||||
|
||||
//@filename: app.tsx
|
||||
import Main from 'mod';
|
||||
declare var Foo, React;
|
||||
// Should see mod_1['default'] in emit here
|
||||
<Foo handler={Main}></Foo>
|
||||
Loading…
x
Reference in New Issue
Block a user