Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
Added Missing Types, Fixed for 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolmahatpurkar committed Jan 8, 2020
1 parent 625aac7 commit f9166f0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
### Features

- 4.2.0

- Refactored entire codebase to TypeScript.
- Switched from yarn to pnpm to manage package dependencies.
- Bundle Size reduced to 4 KB
- No change to the package API or features. Everything should work as before.

- 4.2.0-beta.0

- Refactored entire codebase to TypeScript.
- Refactored entire codebase to TypeScript.
- Switched from yarn to pnpm to manage package dependencies.
- Bundle Size reduced to 4 KB
- No change to the package API or features. Everything should work as before.
Expand All @@ -22,6 +29,7 @@
- 4.0.0

- Breaking Change

- Hide the toast on Click

Before:
Expand Down Expand Up @@ -69,9 +77,9 @@
```javascript
cogoToast.success('This is a success message.', {
onClick: hide => {
hide();
},
onClick: (hide) => {
hide();
},
});
```
Expand Down
11 changes: 8 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEventHandler } from 'react';
import { ReactNode, MouseEventHandler } from 'react';

export type CTOptions = Partial<{
hideAfter: number;
Expand All @@ -25,9 +25,12 @@ export type HideToastFunction = () => void;

export type CTReturn = Promise<void> & { hide?: HideToastFunction };

export type CTMethod = (message: string, options?: CTOptions) => CTReturn;
export type CTMethod = (message: string | ReactNode, options?: CTOptions) => CTReturn;

export type CTMainMethod = (message: string, options?: CTOptions & { type: string }) => CTReturn;
export type CTMainMethod = (
message: string | ReactNode,
options?: CTOptions & { type: string },
) => CTReturn;

export type CToast = CTMainMethod & {
success: CTMethod;
Expand All @@ -44,3 +47,5 @@ declare namespace cogoToast {
const warn: CTMethod;
const error: CTMethod;
}

export default cogoToast;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cogo-toast",
"description": "Beautiful, Zero Configuration, Toast Messages - Built with React",
"version": "4.2.0-beta.0",
"version": "4.2.0",
"license": "MIT",
"scripts": {
"setup": "pnpm install && cd docs && pnpm install",
Expand Down

0 comments on commit f9166f0

Please sign in to comment.