Skip to content

Commit

Permalink
Let ESLint have its way about docstring location
Browse files Browse the repository at this point in the history
We should tweak this, but not as part of this backporting.
  • Loading branch information
chriskrycho committed Dec 15, 2022
1 parent f476a20 commit a8fac83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions addon-test-support/@ember/test-helpers/dom/find-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ import { toArray } from '../ie-11-polyfills';
// would simply be defined as a tweaked re-export as `querySelector` is, but it
// is non-trivial (to say the least!) to preserve overloads like this while also
// changing the return type (from `NodeListOf` to `Array`).
export default function findAll<
K extends keyof (HTMLElementTagNameMap | SVGElementTagNameMap)
>(selector: K): Array<HTMLElementTagNameMap[K] | SVGElementTagNameMap[K]>;
export default function findAll<K extends keyof HTMLElementTagNameMap>(
selector: K
): Array<HTMLElementTagNameMap[K]>;
export default function findAll<K extends keyof SVGElementTagNameMap>(
selector: K
): Array<SVGElementTagNameMap[K]>;
export default function findAll(selector: string): Element[];
/**
Find all elements matched by the given selector. Similar to calling
`querySelectorAll()` on the test root element, but returns an array instead
Expand All @@ -20,16 +30,6 @@ import { toArray } from '../ie-11-polyfills';
</caption>
find('#foo');
*/
export default function findAll<
K extends keyof (HTMLElementTagNameMap | SVGElementTagNameMap)
>(selector: K): Array<HTMLElementTagNameMap[K] | SVGElementTagNameMap[K]>;
export default function findAll<K extends keyof HTMLElementTagNameMap>(
selector: K
): Array<HTMLElementTagNameMap[K]>;
export default function findAll<K extends keyof SVGElementTagNameMap>(
selector: K
): Array<SVGElementTagNameMap[K]>;
export default function findAll(selector: string): Element[];
export default function findAll(selector: string): Element[] {
if (!selector) {
throw new Error('Must pass a selector to `findAll`.');
Expand Down
20 changes: 10 additions & 10 deletions addon-test-support/@ember/test-helpers/dom/find.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import getElement from './-get-element';

// Derived from `querySelector` types.
export default function find<
K extends keyof (HTMLElementTagNameMap | SVGElementTagNameMap)
>(selector: K): HTMLElementTagNameMap[K] | SVGElementTagNameMap[K] | null;
export default function find<K extends keyof HTMLElementTagNameMap>(
selector: K
): HTMLElementTagNameMap[K] | null;
export default function find<K extends keyof SVGElementTagNameMap>(
selector: K
): SVGElementTagNameMap[K] | null;
export default function find(selector: string): Element | null;
/**
Find the first element matched by the given selector. Equivalent to calling
`querySelector()` on the test root element.
Expand All @@ -16,16 +26,6 @@ import getElement from './-get-element';
findAll('.my-selector');
*/
export default function find<
K extends keyof (HTMLElementTagNameMap | SVGElementTagNameMap)
>(selector: K): HTMLElementTagNameMap[K] | SVGElementTagNameMap[K] | null;
export default function find<K extends keyof HTMLElementTagNameMap>(
selector: K
): HTMLElementTagNameMap[K] | null;
export default function find<K extends keyof SVGElementTagNameMap>(
selector: K
): SVGElementTagNameMap[K] | null;
export default function find(selector: string): Element | null;
export default function find(selector: string): Element | null {
if (!selector) {
throw new Error('Must pass a selector to `find`.');
Expand Down

0 comments on commit a8fac83

Please sign in to comment.