diff --git a/d3-selection/index.d.ts b/d3-selection/index.d.ts index 44bf64c0e0..65703f66ff 100644 --- a/d3-selection/index.d.ts +++ b/d3-selection/index.d.ts @@ -503,63 +503,24 @@ interface Selection(type: string, before: string): Selection; - /** - * Inserts a new element of the type provided by the element creator function before the element matching the specified "before" - * selector string for each selected element. - * - * This method returns a new selection containing the appended elements. - * Each new element inherits the data of the current elements, if any. - * - * The generic refers to the type of the child element to be appended. - * - * @param type A creator function which is evaluated for each selected element, in order, being passed the current datum (d), - * the current index (i), and the current group (nodes), with this as the current DOM element. This function should return - * an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.) - * @param before A CSS selector string for the element before which the insertion should occur. - */ - insert(type: ValueFn, before: string): Selection; - /** - * Inserts a new element of the specified type (tag name) before the element returned by the "before" child selector function - * for each selected element. - * - * This method returns a new selection containing the appended elements. - * Each new element inherits the data of the current elements, if any. - * - * The generic refers to the type of the child element to be appended. - * - * @param type A string representing the tag name for the element type to be inserted. The specified name may have a namespace prefix, - * such as svg:text to specify a text attribute in the SVG namespace. If no namespace is specified, the namespace will be inherited - * from the parent element; or, if the name is one of the known prefixes, the corresponding namespace will be used - * (for example, svg implies svg:svg) - * @param before A child selector function which is evaluated for each selected element, in order, being passed the current datum (d), - * the current index (i), and the current group (nodes), with this as the current DOM element. This function should return the child element - * before which the element should be inserted. - */ - insert(type: string, before: ValueFn): Selection; - /** - * Inserts a new element of the type provided by the element creator function before the element returned by the "before" child selector function - * for each selected element. - * - * This method returns a new selection containing the appended elements. - * Each new element inherits the data of the current elements, if any. - * - * The generic refers to the type of the child element to be appended. - * - * @param type A creator function which is evaluated for each selected element, in order, being passed the current datum (d), - * the current index (i), and the current group (nodes), with this as the current DOM element. This function should return - * an element to be inserted. (The function typically creates a new element, but it may instead return an existing element.) - * @param before A child selector function which is evaluated for each selected element, in order, being passed the current datum (d), - * the current index (i), and the current group (nodes), with this as the current DOM element. This function should return the child element - * before which the element should be inserted. - */ - insert(type: ValueFn, before: ValueFn): Selection; + insert( + type: string | ValueFn, + before: string | ValueFn + ): Selection; /** * Removes the selected elements from the document.