Skip to content
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

Use native querySelector types instead of copying them #31

Closed
wants to merge 2 commits into from
Closed
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
19 changes: 8 additions & 11 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// <reference lib="dom"/>

type QuerySelector = ParentNode['querySelector'];
fregante marked this conversation as resolved.
Show resolved Hide resolved

declare namespace elementReady {
interface Options {
/**
Expand Down Expand Up @@ -63,16 +65,11 @@ import elementReady = require('element-ready');
})();
```
*/
declare function elementReady<ElementName extends keyof HTMLElementTagNameMap>(
selector: ElementName,
options?: elementReady.Options
): elementReady.StoppablePromise<HTMLElementTagNameMap[ElementName] | undefined>;
declare function elementReady<ElementName extends keyof SVGElementTagNameMap>(
selector: ElementName,
options?: elementReady.Options
): elementReady.StoppablePromise<SVGElementTagNameMap[ElementName] | undefined>;
declare function elementReady<ElementName extends Element = Element>(
selector: string,
declare function elementReady<
Selector extends string,
TElement extends Element = QuerySelector<Selector>
fregante marked this conversation as resolved.
Show resolved Hide resolved
>(
selector: Selector,
options?: elementReady.Options
): elementReady.StoppablePromise<ElementName | undefined>;
): elementReady.StoppablePromise<TElement | undefined>;
export = elementReady;