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

Fix(types): add missing reference and popper class properties #759

Merged
merged 4 commits into from Mar 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/popper/index.d.ts
Expand Up @@ -158,6 +158,8 @@ declare class Popper {
static Defaults: PopperOptions;

options: PopperOptions;
popper: HTMLElement;
reference: HTMLElement;

constructor(reference: Element | ReferenceObject, popper: Element, options?: PopperOptions);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference: Element, not HTMLElement?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can also be "custom reference object", we should already have a type for that somewhere

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't have done this at the end of the work day...
It should be:

popper: Element;
reference: Element | ReferenceObject;

I'll try to test and commit before leaving today.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit conflicting also, because in the code you have HTMLElement types for popper and reference, and Element in type definitions.

https://github.com/FezVrasta/popper.js/blob/bd1faa9a27499433443bb4c42b3dea9ecf055777/packages/popper/src/index.js#L17-L18

I'm not sure which one should be the correct one.
See this stackoverflow answer for details.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSDoc types are most likely wrong... But I don't have much time to verify it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be an SVGElement too. So that's why it's the base Element interface


Expand Down