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

[Types] FontAwesome5 and FontAwesome6 Components Typed as any #317

Open
1 task
BellCubeDev opened this issue Nov 17, 2024 · 0 comments
Open
1 task

[Types] FontAwesome5 and FontAwesome6 Components Typed as any #317

BellCubeDev opened this issue Nov 17, 2024 · 0 comments

Comments

@BellCubeDev
Copy link

The Problem

The type definitions for FontAwesome5 and FontAwesome6 are declared as any, whereas the type definitions for other icon components (such as Octicons) use the Icon<G, FN> interface.

declare const iconSet: any;
export default iconSet;
declare const iconSet: any;
export default iconSet;
declare const _default: import("./createIconSet").Icon<"number" | "link" | "search" | "image" | "alert" | "plus" | "info" | "check" | "book" | "question" | "mail" | "home" | "star" | "filter" | "inbox" | "lock" | "eye" | "heart" | "upload" | "download" | "unlock" | "play" | "tag" | "calendar" | "database" | "hourglass" | "key" | "gift" | "sync" | "table" | "archive" | "arrow-down" | "arrow-left" | "arrow-right" | "arrow-up" | "bell" | "bookmark" | "briefcase" | "browser" | "bug" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "circle" | "clock" | "code" | "copy" | "credit-card" | "globe" | "infinity" | "light-bulb" | "location" | "megaphone" | "moon" | "note" | "pencil" | "pin" | "quote" | "reply" | "rocket" | "rss" | "share" | "shield" | "stopwatch" | "tools" | "trash" | "triangle-down" | "triangle-left" | "triangle-right" | "triangle-up" | "video" | "comment" | "gear" | "bold" | "check-circle" | "columns" | "cpu" | "file" | "git-branch" | "git-commit" | "git-merge" | "git-pull-request" | "hash" | "italic" | "package" | "plus-circle" | "server" | "square" | "sun" | "terminal" | "x" | "x-circle" | "zap" | "stop" | "sign-out" | "sign-in" | "strikethrough" | "sort-desc" | "sort-asc" | "paste" | "mortar-board" | "history" | "plug" | "bell-slash" | "diamond" | "id-badge" | "meter" | "ruby" | "markdown" | "file-code" | "heading" | "ellipsis" | "paintbrush" | "person" | "smiley" | "pulse" | "accessibility" | "apps" | "beaker" | "duplicate" | "flame" | "git-compare" | "logo-github" | "people" | "person-add" | "telescope" | "broadcast" | "graph" | "mirror" | "shield-check" | "shield-lock" | "webhook" | "checklist" | "horizontal-rule" | "report" | "verified" | "arrow-both" | "arrow-switch" | "bell-fill" | "blocked" | "bookmark-slash" | "check-circle-fill" | "circle-slash" | "code-of-conduct" | "code-review" | "code-square" | "codescan" | "codescan-checkmark" | "codespaces" | "comment-discussion" | "container" | "cross-reference" | "dash" | "dependabot" | "desktop-download" | "device-camera" | "device-camera-video" | "device-desktop" | "device-mobile" | "diff" | "diff-added" | "diff-ignored" | "diff-modified" | "diff-removed" | "diff-renamed" | "dot" | "dot-fill" | "eye-closed" | "feed-discussion" | "feed-heart" | "feed-person" | "feed-repo" | "feed-rocket" | "feed-star" | "feed-tag" | "file-badge" | "file-binary" | "file-diff" | "file-directory" | "file-submodule" | "file-symlink-file" | "file-zip" | "fold" | "fold-down" | "fold-up" | "git-pull-request-closed" | "git-pull-request-draft" | "grabber" | "heart-fill" | "hubot" | "issue-closed" | "issue-draft" | "issue-opened" | "issue-reopened" | "iterations" | "kebab-horizontal" | "key-asterisk" | "law" | "link-external" | "list-ordered" | "list-unordered" | "log" | "logo-gist" | "mark-github" | "mention" | "milestone" | "multi-select" | "mute" | "no-entry" | "north-star" | "organization" | "package-dependencies" | "package-dependents" | "paper-airplane" | "person-fill" | "project" | "repo" | "repo-clone" | "repo-deleted" | "repo-forked" | "repo-pull" | "repo-push" | "repo-template" | "rows" | "screen-full" | "screen-normal" | "share-android" | "shield-x" | "sidebar-collapse" | "sidebar-expand" | "single-select" | "skip" | "square-fill" | "squirrel" | "stack" | "star-fill" | "tab-external" | "tasklist" | "telescope-fill" | "three-bars" | "thumbsdown" | "thumbsup" | "typography" | "unfold" | "unmute" | "unverified" | "versions" | "workflow" | "x-circle-fill", "octicons">;
export default _default;

This can be traced back to the function createMultiStyleIconSet, which has a return type of any:

export default function createMultiStyleIconSet(styles: FontStyles, optionsInput = {}): any {

As it stands, a type of any eliminates type checking, IntelliSense, and developer certainty on components with an API that differs from the regular createIconSet/Icon<G, FN> component.

Expectation

The FontAwesome5 and FontAwesome6 components should have a more precise type definition, consistent with the level of precision offered elsewhere in the @expo/vector-icons library. Doing so will likely require a variant of the Icon<G, FN> interface, as it is likely not accurate for multi-style icon sets.

To Resolve

  • Add non-any return type to createMultiStyleIconSet (ideally with type precision consistent with the rest of the library)
BellCubeDev added a commit to Stockedhome/stockedhome-application that referenced this issue Nov 17, 2024
* Fixed icon & font rendering on native
* Code now ensures NEXT_PUBLIC_ and EXPO_PUBLIC_ ENV vars are duplicated across both names
* Createed util for getting public ENV vars
* Added asset/CDN prefix
* Fixed some type errors
* Added Dripsy-ified variants of used `@expo/vector-icons` components (also see: expo/vector-icons#317)
* Updated Solito fork to use a `'link'` variant by default for the `<TextLink>`'s child `<P>` component
  * Renamed `'a'` variant to `'link'`
* Updated Solito fork to fix a mistake in Solito's typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant