Skip to content
Merged
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
9 changes: 9 additions & 0 deletions types/canvas-confetti/canvas-confetti-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ confetti({
y: 0.6
}
});

const canvas = document.createElement('canvas');
const myConfetti = confetti.create(canvas);

myConfetti();

myConfetti({
particleCount: 150
});
10 changes: 9 additions & 1 deletion types/canvas-confetti/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for canvas-confetti 0.0
// Type definitions for canvas-confetti 0.1
// Project: https://github.com/catdad/canvas-confetti#readme
// Definitions by: Martin Tracey <https://github.com/matracey>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
Expand Down Expand Up @@ -81,6 +81,14 @@ declare namespace confetti {
*/
y?: number;
}
interface GlobalOptions {
resize: boolean;
}

function create(
canvas: HTMLCanvasElement,
options?: GlobalOptions
): (options?: Options) => Promise<null> | null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's actually a Promise<void> (when it's not null), but that's also a problem with the top level function confetti

}

export = confetti;
3 changes: 2 additions & 1 deletion types/canvas-confetti/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
Expand Down