-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# v1.0.7 | ||
- Switch | ||
- Add debug props, if `debug={true}` console.warn if no `Case` match nor `Default` | ||
- Case | ||
- children props can now be a render props. `children={matchedValue => (<span>{matchedValue}</span>)}` | ||
- Default | ||
- children props can now be a render props. `children={() => (<span>Default</span>)}` | ||
- Match | ||
- children props can now be a render props. `children={matchValue => (<span>{matchValue}</span>)}` | ||
- same for `fallback` props |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import React from "react"; | ||
import { ICaseProps } from "./ICase"; | ||
export default class Case<T> extends React.Component<ICaseProps<T>> { | ||
render(): JSX.Element | (JSX.Element & string) | (JSX.Element & number) | (JSX.Element & false) | (JSX.Element & true) | (JSX.Element & React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | (JSX.Element & React.ReactNodeArray) | (JSX.Element & React.ReactPortal); | ||
render(): JSX.Element | JSX.Element[] | (((value: T) => JSX.Element | JSX.Element[]) & string) | (((value: T) => JSX.Element | JSX.Element[]) & number) | (((value: T) => JSX.Element | JSX.Element[]) & false) | (((value: T) => JSX.Element | JSX.Element[]) & true) | (((value: T) => JSX.Element | JSX.Element[]) & React.ReactNodeArray); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import React from "react"; | ||
import { IDefaultProps } from "./IDefault"; | ||
export default class Default extends React.Component<IDefaultProps> { | ||
render(): JSX.Element | (JSX.Element & string) | (JSX.Element & number) | (JSX.Element & false) | (JSX.Element & true) | (JSX.Element & React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) | (JSX.Element & React.ReactNodeArray) | (JSX.Element & React.ReactPortal); | ||
render(): JSX.Element | JSX.Element[] | ((() => JSX.Element | JSX.Element[]) & string) | ((() => JSX.Element | JSX.Element[]) & number) | ((() => JSX.Element | JSX.Element[]) & false) | ((() => JSX.Element | JSX.Element[]) & true) | ((() => JSX.Element | JSX.Element[]) & React.ReactNodeArray); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
/// <reference types="react" /> | ||
declare type JSXElements = JSX.Element | JSX.Element[]; | ||
export interface ICaseProps<T> { | ||
value: T; | ||
children: JSX.Element; | ||
children: JSXElements | ((value: T) => JSXElements); | ||
} | ||
export {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/// <reference types="react" /> | ||
declare type JSXElements = JSX.Element | JSX.Element[]; | ||
export interface IDefaultProps { | ||
children: JSX.Element; | ||
children: JSXElements | (() => JSXElements); | ||
} | ||
export {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
/// <reference types="react" /> | ||
declare type JSXElements = JSX.Element | JSX.Element[]; | ||
export interface IMatchProps { | ||
condition: boolean; | ||
fallback?: JSX.Element | null | undefined; | ||
children: JSX.Element; | ||
fallback?: JSXElements | ((condition: boolean) => JSXElements) | null | undefined; | ||
children: JSXElements | ((condition: boolean) => JSXElements); | ||
} | ||
export {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/// <reference types="react" /> | ||
import { IMatchProps } from "./IMatch"; | ||
export default function Match({ condition, fallback, children }: IMatchProps): JSX.Element | null; | ||
export default function Match({ condition, fallback, children }: IMatchProps): JSX.Element | JSX.Element[] | null; |
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.
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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.