🤖 Merge PR #53690 [@types/bootstrap] v5 components getInstance() can return null by @pbrn46

This commit is contained in:
Boris Wong
2021-06-09 14:21:07 -07:00
committed by GitHub
parent b7b168a91d
commit 4304f0feee
20 changed files with 20 additions and 20 deletions

View File

@@ -43,7 +43,7 @@ declare class Carousel extends BaseComponent {
* Static method which allows you to get the carousel instance associated
* with a DOM element.
*/
static getInstance(element: Element, options?: Partial<Carousel.Options>): Carousel;
static getInstance(element: Element, options?: Partial<Carousel.Options>): Carousel | null;
static jQueryInterface: Carousel.jQueryInterface;

View File

@@ -30,7 +30,7 @@ declare class Collapse extends BaseComponent {
* Static method which allows you to get the collapse instance associated
* with a DOM element.
*/
static getInstance(element: Element, options?: Partial<Collapse.Options>): Collapse;
static getInstance(element: Element, options?: Partial<Collapse.Options>): Collapse | null;
static jQueryInterface: Collapse.jQueryInterface;

View File

@@ -28,7 +28,7 @@ declare class Dropdown extends BaseComponent {
* Static method which allows you to get the dropdown instance associated
* with a DOM element.
*/
static getInstance(element: Element, options?: Partial<Dropdown.Options>): Dropdown;
static getInstance(element: Element, options?: Partial<Dropdown.Options>): Dropdown | null;
static jQueryInterface: Dropdown.jQueryInterface;

View File

@@ -32,7 +32,7 @@ declare class Modal extends BaseComponent {
* Static method which allows you to get the modal instance associated with
* a DOM element
*/
static getInstance(element: Element, options?: Partial<Modal.Options>): Modal;
static getInstance(element: Element, options?: Partial<Modal.Options>): Modal | null;
static jQueryInterface: Modal.jQueryInterface;

View File

@@ -11,7 +11,7 @@ declare class Offcanvas extends BaseComponent {
* Static method which allows you to get the offcanvas instance associated to a
* DOM element, you can use it like this: getInstance(offcanvas)
*/
static getInstance(element: Element): Offcanvas;
static getInstance(element: Element): Offcanvas | null;
static jQueryInterface: Offcanvas.jQueryInterface;

View File

@@ -55,7 +55,7 @@ declare class Popover extends BaseComponent {
* Static method which allows you to get the popover instance associated
* with a DOM element
*/
static getInstance(element: Element, options?: Partial<Popover.Options>): Popover;
static getInstance(element: Element, options?: Partial<Popover.Options>): Popover | null;
static jQueryInterface: Popover.jQueryInterface;

View File

@@ -14,7 +14,7 @@ declare class ScrollSpy extends BaseComponent {
* Static method which allows you to get the scrollspy instance associated
* with a DOM element
*/
static getInstance(element: Element, options?: Partial<ScrollSpy.Options>): ScrollSpy;
static getInstance(element: Element, options?: Partial<ScrollSpy.Options>): ScrollSpy | null;
static jQueryInterface: ScrollSpy.jQueryInterface;

View File

@@ -14,7 +14,7 @@ declare class Tab extends BaseComponent {
* Static method which allows you to get the tab instance associated with a
* DOM element
*/
static getInstance(element: Element): Tab;
static getInstance(element: Element): Tab | null;
static jQueryInterface: Tab.jQueryInterface;

View File

@@ -21,7 +21,7 @@ declare class Toast extends BaseComponent {
* Static method which allows you to get the toast instance associated
* with a DOM element
*/
static getInstance(element: Element, options?: Partial<Toast.Options>): Toast;
static getInstance(element: Element, options?: Partial<Toast.Options>): Toast | null;
static jQueryInterface: Toast.jQueryInterface;

View File

@@ -53,7 +53,7 @@ declare class Tooltip extends BaseComponent {
* Static method which allows you to get the tooltip instance associated
* with a DOM element
*/
static getInstance(element: Element): Tooltip;
static getInstance(element: Element): Tooltip | null;
static jQueryInterface: Tooltip.jQueryInterface;

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Carousel
new Carousel(element, { interval: 1000 });
// $ExpectType Carousel
// $ExpectType Carousel | null
Carousel.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Collapse
new Collapse(element, { parent: '.parent' });
// $ExpectType Collapse
// $ExpectType Collapse | null
Collapse.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
new Dropdown(element, { flip: true }); // $ExpectError
new Dropdown(element, { offset: [0, 2] }); // $ExpectType Dropdown
// $ExpectType Dropdown
// $ExpectType Dropdown | null
Dropdown.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Modal
new Modal(element, { backdrop: 'static' });
// $ExpectType Modal
// $ExpectType Modal | null
Modal.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Offcanvas
new Offcanvas(element);
// $ExpectType Offcanvas
// $ExpectType Offcanvas | null
Offcanvas.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Popover
new Popover(element, { delay: 0.5, animation: true });
// $ExpectType Popover
// $ExpectType Popover | null
Popover.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType ScrollSpy
new ScrollSpy(element, { offset: 10 });
// $ExpectType ScrollSpy
// $ExpectType ScrollSpy | null
ScrollSpy.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Tab
new Tab(element);
// $ExpectType Tab
// $ExpectType Tab | null
Tab.getInstance(element);
element.addEventListener(Tab.Events.hidden, event => {

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Toast
new Toast(element, { animation: false });
// $ExpectType Toast
// $ExpectType Toast | null
Toast.getInstance(element);
// $ExpectType string

View File

@@ -6,7 +6,7 @@ const element = new Element();
// $ExpectType Tooltip
new Tooltip(element, { delay: 0.5, title: () => "foo", customClass: () => "custom-class" });
// $ExpectType Tooltip
// $ExpectType Tooltip | null
Tooltip.getInstance(element);
// $ExpectType string