2016-11-08 20:07:17 +01:00
|
|
|
|
/// <reference path='fourslash.ts' />
|
|
|
|
|
|
|
|
|
|
//@Filename: file.tsx
|
|
|
|
|
// @jsx: preserve
|
|
|
|
|
// @noLib: true
|
|
|
|
|
|
|
|
|
|
//// export interface ClickableProps {
|
|
|
|
|
//// children?: string;
|
|
|
|
|
//// className?: string;
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
//// export interface ButtonProps extends ClickableProps {
|
|
|
|
|
//// onClick(event?: React.MouseEvent<HTMLButtonElement>): void;
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
//// export interface LinkProps extends ClickableProps {
|
|
|
|
|
//// to: string;
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
//// export function MainButton(buttonProps: ButtonProps): JSX.Element;
|
|
|
|
|
//// export function MainButton(linkProps: LinkProps): JSX.Element;
|
|
|
|
|
//// export function MainButton(props: ButtonProps | LinkProps): JSX.Element {
|
|
|
|
|
//// const linkProps = props as LinkProps;
|
|
|
|
|
//// if(linkProps.to) {
|
|
|
|
|
//// return this._buildMainLink(props);
|
|
|
|
|
//// }
|
|
|
|
|
//// return this._buildMainButton(props);
|
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
//// function _buildMainButton({ onClick, children, className }: ButtonProps): JSX.Element {
|
2018-07-25 20:53:20 +02:00
|
|
|
|
//// return(<button className={className} onClick={onClick}>{ children || 'MAIN BUTTON'}</button>);
|
2016-11-08 20:07:17 +01:00
|
|
|
|
//// }
|
|
|
|
|
|
|
|
|
|
//// declare function buildMainLink({ to, children, className }: LinkProps): JSX.Element;
|
|
|
|
|
|
|
|
|
|
//// function buildSomeElement1(): JSX.Element {
|
|
|
|
|
//// return (
|
|
|
|
|
//// <MainB/*1*/utton t/*2*/o='/some/path'>GO</MainButton>
|
|
|
|
|
//// );
|
|
|
|
|
//// }
|
|
|
|
|
|
2018-07-25 20:53:20 +02:00
|
|
|
|
//// function buildSomeElement2(): JSX.Element {
|
2016-11-08 20:07:17 +01:00
|
|
|
|
//// return (
|
|
|
|
|
//// <MainB/*3*/utton onC/*4*/lick={()=>{}}>GO</MainButton>;
|
|
|
|
|
//// );
|
|
|
|
|
//// }
|
2018-07-25 20:53:20 +02:00
|
|
|
|
//// let componenet = <MainButton onClick={()=>{}} ext/*5*/ra-prop>GO</MainButton>;
|
2016-11-08 20:07:17 +01:00
|
|
|
|
|
|
|
|
|
verify.quickInfos({
|
|
|
|
|
1: "function MainButton(linkProps: LinkProps): any (+1 overload)",
|
2018-07-25 20:53:20 +02:00
|
|
|
|
2: "(JSX attribute) LinkProps.to: string",
|
2016-11-08 20:07:17 +01:00
|
|
|
|
3: "function MainButton(buttonProps: ButtonProps): any (+1 overload)",
|
2018-07-25 20:53:20 +02:00
|
|
|
|
4: "(method) ButtonProps.onClick(event?: any): void",
|
2016-11-08 20:07:17 +01:00
|
|
|
|
5: "(JSX attribute) extra-prop: true"
|
|
|
|
|
});
|