Repository navigation
Pass undefined for jsxDEV self inside super arguments #65539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Josué Barros (joshbarros)
wants to merge
2
commits into
microsoft:main
from
joshbarros:fix/65415-jsxdev-self-before-super
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
57 changes: 57 additions & 0 deletions
57
tsc/testdata/baselines/reference/compiler/jsxDevSelfInSuperArguments.js
This file contains hidden or 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,57 @@ | ||
| //// [tests/cases/compiler/jsxDevSelfInSuperArguments.tsx] //// | ||
|
|
||
| //// [index.d.ts] | ||
| export namespace JSX { | ||
| interface Element {} | ||
| interface IntrinsicElements { | ||
| h2: {}; | ||
| } | ||
| } | ||
| export function jsxDEV(type: any, props: any, key?: any, isStatic?: boolean, source?: any, self?: any): JSX.Element; | ||
|
|
||
| //// [index.tsx] | ||
| class Base { | ||
| content: any; | ||
| constructor(...args: any[]) { this.content = args[0]; } | ||
| } | ||
| class Card extends Base { | ||
| constructor(title: string) { | ||
| super(<h2>{title}</h2>); | ||
| } | ||
| } | ||
| class Nested extends Base { | ||
| constructor() { | ||
| super({ render() { return <h2 />; } }); | ||
| } | ||
| } | ||
| class Outer extends Base { | ||
| constructor() { | ||
| super(class extends Base { constructor() { super(<h2 />); } }, <h2 />); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| //// [index.js] | ||
| import { jsxDEV as _jsxDEV } from "preact/jsx-dev-runtime"; | ||
| const _jsxFileName = "/index.tsx"; | ||
| class Base { | ||
| content; | ||
| constructor(...args) { this.content = args[0]; } | ||
| } | ||
| class Card extends Base { | ||
| constructor(title) { | ||
| super(_jsxDEV("h2", { children: title }, void 0, false, { fileName: _jsxFileName, lineNumber: 7, columnNumber: 15 }, void 0)); | ||
| } | ||
| } | ||
| class Nested extends Base { | ||
| constructor() { | ||
| super({ render() { return _jsxDEV("h2", {}, void 0, false, { fileName: _jsxFileName, lineNumber: 12, columnNumber: 35 }, this); } }); | ||
| } | ||
| } | ||
| class Outer extends Base { | ||
| constructor() { | ||
| super(class extends Base { | ||
| constructor() { super(_jsxDEV("h2", {}, void 0, false, { fileName: _jsxFileName, lineNumber: 17, columnNumber: 58 }, void 0)); } | ||
| }, _jsxDEV("h2", {}, void 0, false, { fileName: _jsxFileName, lineNumber: 17, columnNumber: 72 }, void 0)); | ||
| } | ||
| } |
80 changes: 80 additions & 0 deletions
80
tsc/testdata/baselines/reference/compiler/jsxDevSelfInSuperArguments.symbols
This file contains hidden or 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,80 @@ | ||
| //// [tests/cases/compiler/jsxDevSelfInSuperArguments.tsx] //// | ||
|
|
||
| === /node_modules/preact/jsx-dev-runtime/index.d.ts === | ||
| export namespace JSX { | ||
| >JSX : Symbol(JSX, Decl(index.d.ts, 0, 0)) | ||
|
|
||
| interface Element {} | ||
| >Element : Symbol(Element, Decl(index.d.ts, 0, 22)) | ||
|
|
||
| interface IntrinsicElements { | ||
| >IntrinsicElements : Symbol(IntrinsicElements, Decl(index.d.ts, 1, 24)) | ||
|
|
||
| h2: {}; | ||
| >h2 : Symbol(IntrinsicElements.h2, Decl(index.d.ts, 2, 33)) | ||
| } | ||
| } | ||
| export function jsxDEV(type: any, props: any, key?: any, isStatic?: boolean, source?: any, self?: any): JSX.Element; | ||
| >jsxDEV : Symbol(jsxDEV, Decl(index.d.ts, 5, 1)) | ||
| >type : Symbol(type, Decl(index.d.ts, 6, 23)) | ||
| >props : Symbol(props, Decl(index.d.ts, 6, 33)) | ||
| >key : Symbol(key, Decl(index.d.ts, 6, 45)) | ||
| >isStatic : Symbol(isStatic, Decl(index.d.ts, 6, 56)) | ||
| >source : Symbol(source, Decl(index.d.ts, 6, 76)) | ||
| >self : Symbol(self, Decl(index.d.ts, 6, 90)) | ||
| >JSX : Symbol(JSX, Decl(index.d.ts, 0, 0)) | ||
| >Element : Symbol(JSX.Element, Decl(index.d.ts, 0, 22)) | ||
|
|
||
| === /index.tsx === | ||
| class Base { | ||
| >Base : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
|
|
||
| content: any; | ||
| >content : Symbol(Base.content, Decl(index.tsx, 0, 12)) | ||
|
|
||
| constructor(...args: any[]) { this.content = args[0]; } | ||
| >args : Symbol(args, Decl(index.tsx, 2, 16)) | ||
| >this.content : Symbol(Base.content, Decl(index.tsx, 0, 12)) | ||
| >this : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
| >content : Symbol(Base.content, Decl(index.tsx, 0, 12)) | ||
| >args : Symbol(args, Decl(index.tsx, 2, 16)) | ||
| } | ||
| class Card extends Base { | ||
| >Card : Symbol(Card, Decl(index.tsx, 3, 1)) | ||
| >Base : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
|
|
||
| constructor(title: string) { | ||
| >title : Symbol(title, Decl(index.tsx, 5, 16)) | ||
|
|
||
| super(<h2>{title}</h2>); | ||
| >super : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
| >h2 : Symbol(JSX.IntrinsicElements.h2, Decl(index.d.ts, 2, 33)) | ||
| >title : Symbol(title, Decl(index.tsx, 5, 16)) | ||
| >h2 : Symbol(JSX.IntrinsicElements.h2, Decl(index.d.ts, 2, 33)) | ||
| } | ||
| } | ||
| class Nested extends Base { | ||
| >Nested : Symbol(Nested, Decl(index.tsx, 8, 1)) | ||
| >Base : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
|
|
||
| constructor() { | ||
| super({ render() { return <h2 />; } }); | ||
| >super : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
| >render : Symbol(render, Decl(index.tsx, 11, 15)) | ||
| >h2 : Symbol(JSX.IntrinsicElements.h2, Decl(index.d.ts, 2, 33)) | ||
| } | ||
| } | ||
| class Outer extends Base { | ||
| >Outer : Symbol(Outer, Decl(index.tsx, 13, 1)) | ||
| >Base : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
|
|
||
| constructor() { | ||
| super(class extends Base { constructor() { super(<h2 />); } }, <h2 />); | ||
| >super : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
| >Base : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
| >super : Symbol(Base, Decl(index.tsx, 0, 0)) | ||
| >h2 : Symbol(JSX.IntrinsicElements.h2, Decl(index.d.ts, 2, 33)) | ||
| >h2 : Symbol(JSX.IntrinsicElements.h2, Decl(index.d.ts, 2, 33)) | ||
| } | ||
| } | ||
|
|
86 changes: 86 additions & 0 deletions
86
tsc/testdata/baselines/reference/compiler/jsxDevSelfInSuperArguments.types
This file contains hidden or 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,86 @@ | ||
| //// [tests/cases/compiler/jsxDevSelfInSuperArguments.tsx] //// | ||
|
|
||
| === /node_modules/preact/jsx-dev-runtime/index.d.ts === | ||
| export namespace JSX { | ||
| interface Element {} | ||
| interface IntrinsicElements { | ||
| h2: {}; | ||
| >h2 : {} | ||
| } | ||
| } | ||
| export function jsxDEV(type: any, props: any, key?: any, isStatic?: boolean, source?: any, self?: any): JSX.Element; | ||
| >jsxDEV : (type: any, props: any, key?: any, isStatic?: boolean, source?: any, self?: any) => JSX.Element | ||
| >type : any | ||
| >props : any | ||
| >key : any | ||
| >isStatic : boolean | undefined | ||
| >source : any | ||
| >self : any | ||
| >JSX : any | ||
|
|
||
| === /index.tsx === | ||
| class Base { | ||
| >Base : Base | ||
|
|
||
| content: any; | ||
| >content : any | ||
|
|
||
| constructor(...args: any[]) { this.content = args[0]; } | ||
| >args : any[] | ||
| >this.content = args[0] : any | ||
| >this.content : any | ||
| >this : this | ||
| >content : any | ||
| >args[0] : any | ||
| >args : any[] | ||
| >0 : 0 | ||
| } | ||
| class Card extends Base { | ||
| >Card : Card | ||
| >Base : Base | ||
|
|
||
| constructor(title: string) { | ||
| >title : string | ||
|
|
||
| super(<h2>{title}</h2>); | ||
| >super(<h2>{title}</h2>) : void | ||
| >super : typeof Base | ||
| ><h2>{title}</h2> : import("preact/jsx-dev-runtime").JSX.Element | ||
| >h2 : any | ||
| >title : string | ||
| >h2 : any | ||
| } | ||
| } | ||
| class Nested extends Base { | ||
| >Nested : Nested | ||
| >Base : Base | ||
|
|
||
| constructor() { | ||
| super({ render() { return <h2 />; } }); | ||
| >super({ render() { return <h2 />; } }) : void | ||
| >super : typeof Base | ||
| >{ render() { return <h2 />; } } : { render(): import("preact/jsx-dev-runtime").JSX.Element; } | ||
| >render : () => import("preact/jsx-dev-runtime").JSX.Element | ||
| ><h2 /> : import("preact/jsx-dev-runtime").JSX.Element | ||
| >h2 : any | ||
| } | ||
| } | ||
| class Outer extends Base { | ||
| >Outer : Outer | ||
| >Base : Base | ||
|
|
||
| constructor() { | ||
| super(class extends Base { constructor() { super(<h2 />); } }, <h2 />); | ||
| >super(class extends Base { constructor() { super(<h2 />); } }, <h2 />) : void | ||
| >super : typeof Base | ||
| >class extends Base { constructor() { super(<h2 />); } } : typeof (Anonymous class) | ||
| >Base : Base | ||
| >super(<h2 />) : void | ||
| >super : typeof Base | ||
| ><h2 /> : import("preact/jsx-dev-runtime").JSX.Element | ||
| >h2 : any | ||
| ><h2 /> : import("preact/jsx-dev-runtime").JSX.Element | ||
| >h2 : any | ||
| } | ||
| } | ||
|
|
34 changes: 34 additions & 0 deletions
34
tsc/testdata/tests/cases/compiler/jsxDevSelfInSuperArguments.tsx
This file contains hidden or 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,34 @@ | ||
| // @jsx: react-jsxdev | ||
| // @jsxImportSource: preact | ||
| // @target: esnext | ||
| // @module: esnext | ||
|
|
||
| // @filename: /node_modules/preact/jsx-dev-runtime/index.d.ts | ||
| export namespace JSX { | ||
| interface Element {} | ||
| interface IntrinsicElements { | ||
| h2: {}; | ||
| } | ||
| } | ||
| export function jsxDEV(type: any, props: any, key?: any, isStatic?: boolean, source?: any, self?: any): JSX.Element; | ||
|
|
||
| // @filename: /index.tsx | ||
| class Base { | ||
| content: any; | ||
| constructor(...args: any[]) { this.content = args[0]; } | ||
| } | ||
| class Card extends Base { | ||
| constructor(title: string) { | ||
| super(<h2>{title}</h2>); | ||
| } | ||
| } | ||
| class Nested extends Base { | ||
| constructor() { | ||
| super({ render() { return <h2 />; } }); | ||
| } | ||
| } | ||
| class Outer extends Base { | ||
| constructor() { | ||
| super(class extends Base { constructor() { super(<h2 />); } }, <h2 />); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.