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

Issue with TypeScript definitions for selectTab #11193

Closed
glen-84 opened this issue Apr 20, 2018 · 2 comments · Fixed by #11274
Closed

Issue with TypeScript definitions for selectTab #11193

glen-84 opened this issue Apr 20, 2018 · 2 comments · Fixed by #11274
Assignees

Comments

@glen-84
Copy link
Contributor

glen-84 commented Apr 20, 2018

How to reproduce this bug:

  1. Use code like $("#matchGames").foundation("selectTab", "#result");

What should happen:

No TypeScript error – elem can be a string according to the docs.

What happened instead:

TypeScript error: Argument of type '"#result"' is not assignable to parameter of type 'JQuery<HTMLElement>'.

image

The problem is here:

interface JQuery {
  foundation(method?: string|Array<any>, $element?: JQuery): JQuery;
}

... but changing that might not be ideal?

Browser(s) and Device(s) tested on:

n/a

Foundation Version(s) you are using:

6.4.3

Test case link:

n/a

DaSchTour added a commit to kpsdotcom/foundation-sites that referenced this issue Apr 24, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@DaSchTour
Copy link
Contributor

Can you please check if the changed definition file here #11199 fixes the problem

@DaSchTour DaSchTour self-assigned this Apr 24, 2018
@glen-84
Copy link
Contributor Author

glen-84 commented Apr 24, 2018

@DaSchTour It looks like it does. Thanks!

@DaSchTour DaSchTour removed their assignment May 15, 2018
@ncoden ncoden added PR open and removed PR open labels May 15, 2018
@ncoden ncoden self-assigned this May 15, 2018
ncoden added a commit to ncoden/foundation-sites that referenced this issue May 16, 2018


Foundation public methods does not all take a jQuery element as first parameter. They can actually take anything and the jQuery interface does not allow to know by the method definition to which plugin the method belong (and what are its arguments types). So the only solution seems to accept anything.

See foundation#11199 (comment)
Closes foundation#11193
@ncoden ncoden added the PR open label May 18, 2018
ncoden added a commit that referenced this issue May 24, 2018
…-definition-11193

fix: fix Typescript jQuery foundation method definition #11193
ncoden added a commit to ncoden/foundation-sites that referenced this issue Jun 16, 2018
…n-global-definition-11193 for v6.5.0

cac478c chore: move typescript definitions out of dist folders
5e540b7 fix: fix Typescript jQuery foundation method definition foundation#11193

Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants