Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test cases for when jsxFactory cannot be resolved
  • Loading branch information
sheetalkamat committed Nov 10, 2016
commit a88c2ae1e4ef79a3f076c0f7c3fcb3aabc1f1cb3
24 changes: 24 additions & 0 deletions tests/baselines/reference/jsxFactoryIdentifierAsParameter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
===================================================================
JsFile: test.js
mapUrl: test.js.map
sourceRoot:
sources: test.tsx
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/test.js
sourceFile:test.tsx
-------------------------------------------------------------------
>>>"use strict";
>>>class AppComponent {
1 >
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>declare module JSX {
> interface IntrinsicElements {
> [s: string]: any;
> }
>}
>
>
1 >Emitted(2, 1) Source(8, 1) + SourceIndex(0)
---
>>> render(createElement) {
1->^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^
5 > ^^^^^^^^^^^^^^^^^^^->
1->export class AppComponent {
>
2 > render
3 > (
4 > createElement
1->Emitted(3, 5) Source(9, 5) + SourceIndex(0)
2 >Emitted(3, 11) Source(9, 11) + SourceIndex(0)
3 >Emitted(3, 12) Source(9, 12) + SourceIndex(0)
4 >Emitted(3, 25) Source(9, 25) + SourceIndex(0)
---
>>> return createElement("div", null);
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
1->) {
>
2 > return
3 >
4 > <div />
5 > ;
1->Emitted(4, 9) Source(10, 9) + SourceIndex(0)
2 >Emitted(4, 15) Source(10, 15) + SourceIndex(0)
3 >Emitted(4, 16) Source(10, 16) + SourceIndex(0)
4 >Emitted(4, 42) Source(10, 23) + SourceIndex(0)
5 >Emitted(4, 43) Source(10, 24) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(5, 5) Source(11, 5) + SourceIndex(0)
2 >Emitted(5, 6) Source(11, 6) + SourceIndex(0)
---
>>>}
1 >^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>}
1 >Emitted(6, 2) Source(12, 2) + SourceIndex(0)
---
>>>exports.AppComponent = AppComponent;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1->
2 >export class AppComponent {
> render(createElement) {
> return <div />;
> }
>}
1->Emitted(7, 1) Source(8, 1) + SourceIndex(0)
2 >Emitted(7, 37) Source(12, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=test.js.map
25 changes: 25 additions & 0 deletions tests/baselines/reference/jsxFactoryIdentifierAsParameter.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
=== tests/cases/compiler/test.tsx ===

declare module JSX {
>JSX : Symbol(JSX, Decl(test.tsx, 0, 0))

interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(test.tsx, 1, 20))

[s: string]: any;
>s : Symbol(s, Decl(test.tsx, 3, 9))
}
}

export class AppComponent {
>AppComponent : Symbol(AppComponent, Decl(test.tsx, 5, 1))

render(createElement) {
>render : Symbol(AppComponent.render, Decl(test.tsx, 7, 27))
>createElement : Symbol(createElement, Decl(test.tsx, 8, 11))

return <div />;
>div : Symbol(unknown)
}
}

26 changes: 26 additions & 0 deletions tests/baselines/reference/jsxFactoryIdentifierAsParameter.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
=== tests/cases/compiler/test.tsx ===

declare module JSX {
>JSX : any

interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements

[s: string]: any;
>s : string
}
}

export class AppComponent {
>AppComponent : AppComponent

render(createElement) {
>render : (createElement: any) => any
>createElement : any

return <div />;
><div /> : any
>div : any
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
tests/cases/compiler/test.tsx(10,17): error TS2304: Cannot find name 'createElement'.


==== tests/cases/compiler/test.tsx (1 errors) ====

declare module JSX {
interface IntrinsicElements {
[s: string]: any;
}
}

export class AppComponent {
render() {
return <div />;
~~~
!!! error TS2304: Cannot find name 'createElement'.
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
===================================================================
JsFile: test.js
mapUrl: test.js.map
sourceRoot:
sources: test.tsx
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/test.js
sourceFile:test.tsx
-------------------------------------------------------------------
>>>"use strict";
>>>class AppComponent {
1 >
2 >^^^^^^^^^^^^^^^->
1 >
>declare module JSX {
> interface IntrinsicElements {
> [s: string]: any;
> }
>}
>
>
1 >Emitted(2, 1) Source(8, 1) + SourceIndex(0)
---
>>> render() {
1->^^^^
2 > ^^^^^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->export class AppComponent {
>
2 > render
1->Emitted(3, 5) Source(9, 5) + SourceIndex(0)
2 >Emitted(3, 11) Source(9, 11) + SourceIndex(0)
---
>>> return createElement("div", null);
1->^^^^^^^^
2 > ^^^^^^
3 > ^
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
5 > ^
1->() {
>
2 > return
3 >
4 > <div />
5 > ;
1->Emitted(4, 9) Source(10, 9) + SourceIndex(0)
2 >Emitted(4, 15) Source(10, 15) + SourceIndex(0)
3 >Emitted(4, 16) Source(10, 16) + SourceIndex(0)
4 >Emitted(4, 42) Source(10, 23) + SourceIndex(0)
5 >Emitted(4, 43) Source(10, 24) + SourceIndex(0)
---
>>> }
1 >^^^^
2 > ^
1 >
>
2 > }
1 >Emitted(5, 5) Source(11, 5) + SourceIndex(0)
2 >Emitted(5, 6) Source(11, 6) + SourceIndex(0)
---
>>>}
1 >^
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>}
1 >Emitted(6, 2) Source(12, 2) + SourceIndex(0)
---
>>>exports.AppComponent = AppComponent;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1->
2 >export class AppComponent {
> render() {
> return <div />;
> }
>}
1->Emitted(7, 1) Source(8, 1) + SourceIndex(0)
2 >Emitted(7, 37) Source(12, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=test.js.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tests/cases/compiler/test.tsx(10,17): error TS2304: Cannot find name 'MyElement'.


==== tests/cases/compiler/test.tsx (1 errors) ====

declare module JSX {
interface IntrinsicElements {
[s: string]: any;
}
}

export class AppComponent {
render(createElement) {
return <div />;
~~~
!!! error TS2304: Cannot find name 'MyElement'.
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading