-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Component commits: 0d61b14 addImplementationSuccessElaboration admits declarations with no symbol Co-authored-by: Wesley Wigham <[email protected]>
- Loading branch information
Showing
6 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/jsxCallElaborationCheckNoCrash1.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
tests/cases/compiler/jsxCallElaborationCheckNoCrash1.tsx(10,29): error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes<Tag, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>'. | ||
|
||
|
||
==== tests/cases/compiler/jsxCallElaborationCheckNoCrash1.tsx (1 errors) ==== | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
|
||
import * as React from "react"; | ||
|
||
type Tags = "span" | "div"; | ||
|
||
export const Hoc = <Tag extends Tags>( | ||
TagElement: Tag, | ||
): React.SFC => { | ||
const Component = () => <TagElement />; | ||
~~~~~~~~~~ | ||
!!! error TS2322: Type '{}' is not assignable to type 'LibraryManagedAttributes<Tag, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>'. | ||
return Component; | ||
}; | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/jsxCallElaborationCheckNoCrash1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//// [jsxCallElaborationCheckNoCrash1.tsx] | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
|
||
import * as React from "react"; | ||
|
||
type Tags = "span" | "div"; | ||
|
||
export const Hoc = <Tag extends Tags>( | ||
TagElement: Tag, | ||
): React.SFC => { | ||
const Component = () => <TagElement />; | ||
return Component; | ||
}; | ||
|
||
|
||
//// [jsxCallElaborationCheckNoCrash1.js] | ||
"use strict"; | ||
/// <reference path="react16.d.ts" /> | ||
exports.__esModule = true; | ||
exports.Hoc = void 0; | ||
var React = require("react"); | ||
var Hoc = function (TagElement) { | ||
var Component = function () { return React.createElement(TagElement, null); }; | ||
return Component; | ||
}; | ||
exports.Hoc = Hoc; |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/jsxCallElaborationCheckNoCrash1.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
=== tests/cases/compiler/jsxCallElaborationCheckNoCrash1.tsx === | ||
/// <reference path="react16.d.ts" /> | ||
|
||
import * as React from "react"; | ||
>React : Symbol(React, Decl(jsxCallElaborationCheckNoCrash1.tsx, 2, 6)) | ||
|
||
type Tags = "span" | "div"; | ||
>Tags : Symbol(Tags, Decl(jsxCallElaborationCheckNoCrash1.tsx, 2, 31)) | ||
|
||
export const Hoc = <Tag extends Tags>( | ||
>Hoc : Symbol(Hoc, Decl(jsxCallElaborationCheckNoCrash1.tsx, 6, 12)) | ||
>Tag : Symbol(Tag, Decl(jsxCallElaborationCheckNoCrash1.tsx, 6, 20)) | ||
>Tags : Symbol(Tags, Decl(jsxCallElaborationCheckNoCrash1.tsx, 2, 31)) | ||
|
||
TagElement: Tag, | ||
>TagElement : Symbol(TagElement, Decl(jsxCallElaborationCheckNoCrash1.tsx, 6, 38)) | ||
>Tag : Symbol(Tag, Decl(jsxCallElaborationCheckNoCrash1.tsx, 6, 20)) | ||
|
||
): React.SFC => { | ||
>React : Symbol(React, Decl(jsxCallElaborationCheckNoCrash1.tsx, 2, 6)) | ||
>SFC : Symbol(React.SFC, Decl(react16.d.ts, 400, 9)) | ||
|
||
const Component = () => <TagElement />; | ||
>Component : Symbol(Component, Decl(jsxCallElaborationCheckNoCrash1.tsx, 9, 8)) | ||
>TagElement : Symbol(TagElement, Decl(jsxCallElaborationCheckNoCrash1.tsx, 6, 38)) | ||
|
||
return Component; | ||
>Component : Symbol(Component, Decl(jsxCallElaborationCheckNoCrash1.tsx, 9, 8)) | ||
|
||
}; | ||
|
30 changes: 30 additions & 0 deletions
30
tests/baselines/reference/jsxCallElaborationCheckNoCrash1.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
=== tests/cases/compiler/jsxCallElaborationCheckNoCrash1.tsx === | ||
/// <reference path="react16.d.ts" /> | ||
|
||
import * as React from "react"; | ||
>React : typeof React | ||
|
||
type Tags = "span" | "div"; | ||
>Tags : Tags | ||
|
||
export const Hoc = <Tag extends Tags>( | ||
>Hoc : <Tag extends Tags>(TagElement: Tag) => React.SFC | ||
><Tag extends Tags>( TagElement: Tag,): React.SFC => { const Component = () => <TagElement />; return Component;} : <Tag extends Tags>(TagElement: Tag) => React.SFC | ||
|
||
TagElement: Tag, | ||
>TagElement : Tag | ||
|
||
): React.SFC => { | ||
>React : any | ||
|
||
const Component = () => <TagElement />; | ||
>Component : () => JSX.Element | ||
>() => <TagElement /> : () => JSX.Element | ||
><TagElement /> : JSX.Element | ||
>TagElement : Tag | ||
|
||
return Component; | ||
>Component : () => JSX.Element | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @jsx: react | ||
/// <reference path="/.lib/react16.d.ts" /> | ||
|
||
import * as React from "react"; | ||
|
||
type Tags = "span" | "div"; | ||
|
||
export const Hoc = <Tag extends Tags>( | ||
TagElement: Tag, | ||
): React.SFC => { | ||
const Component = () => <TagElement />; | ||
return Component; | ||
}; |