-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
110 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
import * as _hooks from '../../hooks'; | ||
import * as preact from '../../src'; | ||
import { ForwardFn } from './internal'; | ||
export * from './suspense'; | ||
import { Suspense, lazy } from './suspense'; | ||
|
||
export * from '../../hooks'; | ||
export import Component = preact.Component; | ||
export import createContext = preact.createContext; | ||
export import createRef = preact.createRef; | ||
export import Fragment = preact.Fragment; | ||
export import createElement = preact.createElement | ||
export import cloneElement = preact.cloneElement | ||
|
||
export declare const version: string; | ||
|
||
export declare function createPortal(vnode: preact.VNode, container: Element | Element): preact.VNode<any>; | ||
|
||
export declare function render(vnode: preact.VNode<any>, parent: Element, callback?: () => void): Component | null; | ||
|
||
export declare function hydrate(vnode: preact.VNode<any>, parent: Element, callback?: () => void): Component | null; | ||
|
||
export declare function unmountComponentAtNode(container: Element | Document | ShadowRoot | DocumentFragment): boolean; | ||
|
||
export declare function createFactory(type: preact.VNode["type"]): preact.VNode<{}>; | ||
|
||
export declare function isValidElement(element: any): boolean; | ||
|
||
export declare function findDOMNode(component: preact.Component): Element | null; | ||
|
||
export declare interface PureComponent<P = {}, S = {}> extends preact.Component { | ||
isPureReactComponenet: boolean; | ||
import * as _Suspense from './suspense'; | ||
|
||
// export default React; | ||
export = React; | ||
declare namespace React { | ||
// Export JSX | ||
export import JSX = preact.JSX; | ||
|
||
// Hooks | ||
export import CreateHandle = _hooks.CreateHandle; | ||
export import EffectCallback = _hooks.EffectCallback; | ||
export import Inputs = _hooks.Inputs; | ||
export import PropRef = _hooks.PropRef; | ||
export import Reducer = _hooks.Reducer; | ||
export import Ref = _hooks.Ref; | ||
export import StateUpdater = _hooks.StateUpdater; | ||
export import useCallback = _hooks.useCallback; | ||
export import useContext = _hooks.useContext; | ||
export import useDebugValue = _hooks.useDebugValue; | ||
export import useEffect = _hooks.useEffect; | ||
export import useImperativeHandle = _hooks.useImperativeHandle; | ||
export import useLayoutEffect = _hooks.useLayoutEffect; | ||
export import useMemo = _hooks.useMemo; | ||
export import useReducer = _hooks.useReducer; | ||
export import useRef = _hooks.useRef; | ||
export import useState = _hooks.useState; | ||
|
||
// Preact Defaults | ||
export import Component = preact.Component; | ||
export import createContext = preact.createContext; | ||
export import createRef = preact.createRef; | ||
export import Fragment = preact.Fragment; | ||
export import createElement = preact.createElement; | ||
export import cloneElement = preact.cloneElement; | ||
|
||
// Suspense | ||
export import Suspense = _Suspense.Suspense; | ||
export import lazy = _Suspense.lazy; | ||
|
||
// Compat | ||
export const version: string; | ||
|
||
export function createPortal(vnode: preact.VNode, container: Element): preact.VNode<any>; | ||
|
||
export function render(vnode: preact.VNode<any>, parent: Element, callback?: () => void): Component | null; | ||
|
||
export function hydrate(vnode: preact.VNode<any>, parent: Element, callback?: () => void): Component | null; | ||
|
||
export function unmountComponentAtNode(container: Element | Document | ShadowRoot | DocumentFragment): boolean; | ||
|
||
export function createFactory(type: preact.VNode["type"]): preact.VNode<{}>; | ||
export function isValidElement(element: any): boolean; | ||
export function findDOMNode(component: preact.Component): Element | null; | ||
|
||
export interface PureComponent<P = {}, S = {}> extends preact.Component { | ||
isPureReactComponenet: boolean; | ||
} | ||
|
||
export function memo<P = {}>(component: preact.FunctionalComponent<P>, comparer?: (prev: P, next: P) => boolean): preact.FunctionComponent<P>; | ||
|
||
export function forwardRef<P = {}>(fn: ForwardFn<P, any>): preact.FunctionalComponent<P>; | ||
|
||
export function unstable_batchedUpdates(callback: (arg?: any) => void, arg?: any): void; | ||
|
||
export interface Children { | ||
map<T extends preact.ComponentChild, R>(children: T | T[], fn: (child: T, i: number, array: T[]) => R): R[]; | ||
forEach<T extends preact.ComponentChild>(children: T | T[], fn: (child: T, i: number, array: T[]) => void): void; | ||
count: (children: preact.ComponentChildren) => number; | ||
only: (children: preact.ComponentChildren) => preact.ComponentChild; | ||
toArray: (children: preact.ComponentChildren) => preact.VNode<{}>[]; | ||
} | ||
} | ||
|
||
export declare function memo<P = {}>(component: preact.FunctionalComponent<P>, comparer?: (prev: P, next: P) => boolean): preact.FunctionComponent<P>; | ||
|
||
export declare function forwardRef<P = {}>(fn: ForwardFn<P, any>): preact.FunctionalComponent<P>; | ||
|
||
export declare function unstable_batchedUpdates(callback: (arg?: any) => void, arg?: any): void; | ||
|
||
|
||
export declare interface Children { | ||
map<T extends preact.ComponentChild, R>(children: T | T[], fn: (child: T, i: number, array: T[]) => R): R[]; | ||
forEach<T extends preact.ComponentChild>(children: T | T[], fn: (child: T, i: number, array: T[]) => void): void; | ||
count: (children: preact.ComponentChildren) => number; | ||
only: (children: preact.ComponentChildren) => preact.ComponentChild; | ||
toArray: (children: preact.ComponentChildren) => preact.VNode<{}>[]; | ||
} | ||
|
||
declare const _default: { | ||
hooks: typeof _hooks, | ||
Component: Component, | ||
createContext: typeof createContext, | ||
createRef: typeof createRef, | ||
Fragment: typeof Fragment, | ||
createElement: typeof createElement, | ||
cloneElement: typeof cloneElement, | ||
version: typeof version, | ||
createPortal: typeof createPortal, | ||
render: typeof render, | ||
hydrate: typeof render, | ||
unmountComponentAtNode: typeof unmountComponentAtNode, | ||
createFactory: typeof createFactory, | ||
isValidElement: typeof isValidElement, | ||
findDOMNode: typeof findDOMNode, | ||
PureComponent: PureComponent, | ||
memo: typeof memo, | ||
forwardRef: typeof forwardRef, | ||
unstable_batchedUpdates: typeof unstable_batchedUpdates, | ||
Children: Children, | ||
Suspense: typeof Suspense, | ||
lazy: typeof lazy, | ||
}; | ||
|
||
export default _default; |
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
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,6 @@ | ||
import React from '../../src'; | ||
class ReactIsh extends React.Component { | ||
render() { | ||
return <div>Text</div> | ||
} | ||
} |
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,7 @@ | ||
// import React from '../../src'; | ||
import * as React from '../../src'; | ||
class ReactIsh extends React.Component { | ||
render() { | ||
return <div>Text</div> | ||
} | ||
} |
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
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,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", | ||
"module": "es6", | ||
"moduleResolution": "node", | ||
"lib": [ | ||
"es6", | ||
"dom", | ||
], | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"jsx": "react", | ||
"noEmit": true, | ||
"allowSyntheticDefaultImports": true, | ||
}, | ||
"include": [ | ||
"./**/*.ts", | ||
"./**/*.tsx" | ||
] | ||
} |