mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
198 lines
9.0 KiB
Plaintext
198 lines
9.0 KiB
Plaintext
//// [tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload6.tsx] ////
|
|
|
|
=== file.tsx ===
|
|
/// <reference path="react.d.ts" />
|
|
|
|
import React = require('react')
|
|
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
|
|
|
declare function log(...args: any[]): void;
|
|
>log : Symbol(log, Decl(file.tsx, 2, 31))
|
|
>args : Symbol(args, Decl(file.tsx, 4, 21))
|
|
|
|
export interface ClickableProps {
|
|
>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 4, 43))
|
|
|
|
children?: string;
|
|
>children : Symbol(ClickableProps.children, Decl(file.tsx, 6, 33))
|
|
|
|
className?: string;
|
|
>className : Symbol(ClickableProps.className, Decl(file.tsx, 7, 22))
|
|
}
|
|
|
|
export interface ButtonProps extends ClickableProps {
|
|
>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 9, 1))
|
|
>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 4, 43))
|
|
|
|
onClick: React.MouseEventHandler<any>;
|
|
>onClick : Symbol(ButtonProps.onClick, Decl(file.tsx, 11, 53))
|
|
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
|
>MouseEventHandler : Symbol(React.MouseEventHandler, Decl(react.d.ts, 389, 66))
|
|
}
|
|
|
|
export interface LinkProps extends ClickableProps {
|
|
>LinkProps : Symbol(LinkProps, Decl(file.tsx, 13, 1))
|
|
>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 4, 43))
|
|
|
|
to: string;
|
|
>to : Symbol(LinkProps.to, Decl(file.tsx, 15, 51))
|
|
}
|
|
|
|
export interface HyphenProps extends ClickableProps {
|
|
>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 17, 1))
|
|
>ClickableProps : Symbol(ClickableProps, Decl(file.tsx, 4, 43))
|
|
|
|
"data-format": string;
|
|
>"data-format" : Symbol(HyphenProps["data-format"], Decl(file.tsx, 19, 53))
|
|
}
|
|
|
|
let obj = {
|
|
>obj : Symbol(obj, Decl(file.tsx, 23, 3))
|
|
|
|
children: "hi",
|
|
>children : Symbol(children, Decl(file.tsx, 23, 11))
|
|
|
|
to: "boo"
|
|
>to : Symbol(to, Decl(file.tsx, 24, 19))
|
|
}
|
|
let obj1: any;
|
|
>obj1 : Symbol(obj1, Decl(file.tsx, 27, 3))
|
|
|
|
let obj2 = {
|
|
>obj2 : Symbol(obj2, Decl(file.tsx, 28, 3))
|
|
|
|
onClick: () => {}
|
|
>onClick : Symbol(onClick, Decl(file.tsx, 28, 12))
|
|
}
|
|
|
|
export function MainButton(buttonProps: ButtonProps): JSX.Element;
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>buttonProps : Symbol(buttonProps, Decl(file.tsx, 32, 27))
|
|
>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 9, 1))
|
|
>JSX : Symbol(JSX, Decl(react.d.ts, 2355, 1))
|
|
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2358, 27))
|
|
|
|
export function MainButton(linkProps: LinkProps): JSX.Element;
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>linkProps : Symbol(linkProps, Decl(file.tsx, 33, 27))
|
|
>LinkProps : Symbol(LinkProps, Decl(file.tsx, 13, 1))
|
|
>JSX : Symbol(JSX, Decl(react.d.ts, 2355, 1))
|
|
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2358, 27))
|
|
|
|
export function MainButton(hyphenProps: HyphenProps): JSX.Element;
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>hyphenProps : Symbol(hyphenProps, Decl(file.tsx, 34, 27))
|
|
>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 17, 1))
|
|
>JSX : Symbol(JSX, Decl(react.d.ts, 2355, 1))
|
|
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2358, 27))
|
|
|
|
export function MainButton(props: ButtonProps | LinkProps | HyphenProps): JSX.Element {
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>props : Symbol(props, Decl(file.tsx, 35, 27))
|
|
>ButtonProps : Symbol(ButtonProps, Decl(file.tsx, 9, 1))
|
|
>LinkProps : Symbol(LinkProps, Decl(file.tsx, 13, 1))
|
|
>HyphenProps : Symbol(HyphenProps, Decl(file.tsx, 17, 1))
|
|
>JSX : Symbol(JSX, Decl(react.d.ts, 2355, 1))
|
|
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2358, 27))
|
|
|
|
const linkProps = props as LinkProps;
|
|
>linkProps : Symbol(linkProps, Decl(file.tsx, 36, 9))
|
|
>props : Symbol(props, Decl(file.tsx, 35, 27))
|
|
>LinkProps : Symbol(LinkProps, Decl(file.tsx, 13, 1))
|
|
|
|
if(linkProps.to) {
|
|
>linkProps.to : Symbol(LinkProps.to, Decl(file.tsx, 15, 51))
|
|
>linkProps : Symbol(linkProps, Decl(file.tsx, 36, 9))
|
|
>to : Symbol(LinkProps.to, Decl(file.tsx, 15, 51))
|
|
|
|
return this._buildMainLink(props);
|
|
>props : Symbol(props, Decl(file.tsx, 35, 27))
|
|
}
|
|
|
|
return this._buildMainButton(props);
|
|
>props : Symbol(props, Decl(file.tsx, 35, 27))
|
|
}
|
|
|
|
// OK
|
|
const b0 = <MainButton to='/some/path'>GO</MainButton>;
|
|
>b0 : Symbol(b0, Decl(file.tsx, 45, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>to : Symbol(to, Decl(file.tsx, 45, 22))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
|
|
const b1 = <MainButton onClick={(e) => {}}>Hello world</MainButton>;
|
|
>b1 : Symbol(b1, Decl(file.tsx, 46, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>onClick : Symbol(onClick, Decl(file.tsx, 46, 22))
|
|
>e : Symbol(e, Decl(file.tsx, 46, 33))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
|
|
const b2 = <MainButton {...obj} />;
|
|
>b2 : Symbol(b2, Decl(file.tsx, 47, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>obj : Symbol(obj, Decl(file.tsx, 23, 3))
|
|
|
|
const b3 = <MainButton {...{to: 10000}} {...obj} />;
|
|
>b3 : Symbol(b3, Decl(file.tsx, 48, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>to : Symbol(to, Decl(file.tsx, 48, 28))
|
|
>obj : Symbol(obj, Decl(file.tsx, 23, 3))
|
|
|
|
const b4 = <MainButton {...obj1} />; // any; just pick the first overload
|
|
>b4 : Symbol(b4, Decl(file.tsx, 49, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>obj1 : Symbol(obj1, Decl(file.tsx, 27, 3))
|
|
|
|
const b5 = <MainButton {...obj1} to="/to/somewhere" />; // should pick the second overload
|
|
>b5 : Symbol(b5, Decl(file.tsx, 50, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>obj1 : Symbol(obj1, Decl(file.tsx, 27, 3))
|
|
>to : Symbol(to, Decl(file.tsx, 50, 32))
|
|
|
|
const b6 = <MainButton {...obj2} />;
|
|
>b6 : Symbol(b6, Decl(file.tsx, 51, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>obj2 : Symbol(obj2, Decl(file.tsx, 28, 3))
|
|
|
|
const b7 = <MainButton {...{onClick: () => { log("hi") }}} />;
|
|
>b7 : Symbol(b7, Decl(file.tsx, 52, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>onClick : Symbol(onClick, Decl(file.tsx, 52, 28))
|
|
>log : Symbol(log, Decl(file.tsx, 2, 31))
|
|
|
|
const b8 = <MainButton {...{onClick() {}}} />; // OK; method declaration get retained (See GitHub #13365)
|
|
>b8 : Symbol(b8, Decl(file.tsx, 53, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>onClick : Symbol(onClick, Decl(file.tsx, 53, 28))
|
|
|
|
const b9 = <MainButton to='/some/path' extra-prop>GO</MainButton>;
|
|
>b9 : Symbol(b9, Decl(file.tsx, 54, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>to : Symbol(to, Decl(file.tsx, 54, 22))
|
|
>extra-prop : Symbol(extra-prop, Decl(file.tsx, 54, 38))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
|
|
const b10 = <MainButton to='/some/path' children="hi" ></MainButton>;
|
|
>b10 : Symbol(b10, Decl(file.tsx, 55, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>to : Symbol(to, Decl(file.tsx, 55, 23))
|
|
>children : Symbol(children, Decl(file.tsx, 55, 39))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
|
|
const b11 = <MainButton onClick={(e) => {}} className="hello" data-format>Hello world</MainButton>;
|
|
>b11 : Symbol(b11, Decl(file.tsx, 56, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>onClick : Symbol(onClick, Decl(file.tsx, 56, 23))
|
|
>e : Symbol(e, Decl(file.tsx, 56, 34))
|
|
>className : Symbol(className, Decl(file.tsx, 56, 43))
|
|
>data-format : Symbol(data-format, Decl(file.tsx, 56, 61))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
|
|
const b12 = <MainButton data-format="Hello world" />
|
|
>b12 : Symbol(b12, Decl(file.tsx, 57, 5))
|
|
>MainButton : Symbol(MainButton, Decl(file.tsx, 30, 1), Decl(file.tsx, 32, 66), Decl(file.tsx, 33, 62), Decl(file.tsx, 34, 66))
|
|
>data-format : Symbol(data-format, Decl(file.tsx, 57, 23))
|
|
|
|
|
|
|