Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

New: add TypeScript definitions #17

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"url": "http://github.com/developit/preact-css-transition-group/issues"
},
"license": "MIT",
"types": "src/index.d.ts",
"devDependencies": {
"babel-core": "^6.6.4",
"babel-eslint": "^6.1.2",
Expand Down
58 changes: 58 additions & 0 deletions 58 src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
declare module "preact-css-transition-group" {
import {
Component,
ComponentProps,
FunctionalComponent,
AnyComponent
} from "preact";

interface CSSTransitionGroupProps<
C extends Component<any, any> | FunctionalComponent<any>
> extends ComponentProps<C> {
transitionName: string;
/** Defaults to true. */
transitionEnter?: boolean;
/** Defaults to true. */
transitionLeave?: boolean;
transitionEnterTimeout?: number;
transitionLeaveTimeout?: number;

/**
* The Preact AnyComponent or DOM component string used to render the
* CSSTransitionGroup. Defaults to 'span'.
*/
component?: AnyComponent<any, any> | string;

/**
* Any additional properties specified on the CSSTransitionGroup will be
* passed to component. e.g.:
* <CSSTransitionGroup transitionName='foo' component='div' class='foo'
* bar={1}>
* ... children ...
* </CSSTransitionGroup>
* Will render as:
* <div class='foo' bar='1'>... children ...</div>
*/
[name: string]: any;
}

// todo: import from Preact instead pending
// https://github.com/developit/preact/pull/869.
type ComponentChild = JSX.Element | string;
type ComponentChildren = ComponentChild[];

interface CSSTransitionGroupState {
children: ComponentChildren;
}

type Key = string | number | any;

export default abstract class CSSTransitionGroup extends Component<
CSSTransitionGroupProps<CSSTransitionGroup>,
any
> {
performEnter(key: Key): void;
performLeave(key: Key): void;
stop(key: Key): void;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.