Skip to content

Commit

Permalink
[ityped] Update definitions entirely, adapting to v 1.0.x (Definitely…
Browse files Browse the repository at this point in the history
…Typed#49754)

* Update definitions of init & Configuration to v1.0.x

* Add test to pass Element as first argument

* Add maintainer of 'ityped' modules

* Change return type of onFinished to void

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
  • Loading branch information
MaySoMusician and DanielRosenwasser authored Nov 24, 2020
1 parent 7ebf0c1 commit 9fb6c8d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
14 changes: 11 additions & 3 deletions types/ityped/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
// Type definitions for ityped 0.0
// Type definitions for ityped 1.0
// Project: https://github.com/luisvinicius167/ityped
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// MaySoMusician <https://github.com/MaySoMusician>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export interface Configuration {
strings?: string[];
typeSpeed?: number;
pause?: number;
backSpeed?: number;
backDelay?: number;
startDelay?: number;
cursorChar?: string;
placeholder?: boolean;
showCursor?: boolean;
disableBackTyping?: boolean;
onFinished?: () => void;
loop?: boolean;
}

export function init(element: string, config: Configuration): void;
export function init(element: string | Element, config: Configuration): void;

export as namespace ityped;
19 changes: 10 additions & 9 deletions types/ityped/ityped-tests.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { init } from "ityped";
import { init } from 'ityped';

const config = {
strings: [
"Strings!",
],
strings: ['Strings!'],
typeSpeed: 120,
pause: 500,
loop: true
loop: true,
};

init("#selector", config);
init('#selector', config);

init("#anotherSelector", {
loop: false
init('#anotherSelector', {
loop: false,
});

init("#anotherOne", {});
init('#anotherOne', {});

const element = document.createElement('span');
init(element, {});
3 changes: 2 additions & 1 deletion types/ityped/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

0 comments on commit 9fb6c8d

Please sign in to comment.