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

Bug: typescript error "TS2304: Cannot find name 'IconDefinition'" #20165

Open
1 of 2 tasks
anatolii-babkin opened this issue Mar 23, 2024 · 2 comments
Open
1 of 2 tasks
Assignees
Labels
bug needs-triage This bug needs to be confirmed

Comments

@anatolii-babkin
Copy link

Bug description

It's not possible import specific icons from kit packages in typescript files. If I try to import some icon like this:
import { faAzure } from "@awesome.me/kit-***/icons/kit/custom"

The compilation will fail with following error:
error TS2304: Cannot find name 'IconDefinition'.

file node_modules/@awesome.me/kit-***/icons/modules/kit/custom.d.ts looks like this:

export { IconDefinition, IconPrefix } from '../icon-types.ts';
export const faAzure: IconDefinition;
export const faWindowsRegistry: IconDefinition;

it exports IconDefinition from icon-types.ts file, but IconDefinition is not exported from icon-types.ts file:

node_modules/@awesome.me/kit-***/icons/modules/icon-types.ts:

import type { IconDefinition, IconPack } from '@fortawesome/fontawesome-common-types';
import type { Icon, IconParams } from '@fortawesome/fontawesome-svg-core'

export type IconPrefix = 'fakd'|'fak'|'fas'|'fab';

export type IconName = 'android'|'apple'|'browser'|'ethernet'|'linux'|'shield-keyhole'|'wifi'|'wifi-3'|'wifi-strong'|'windows';

export interface IconPackByPrefix {
  [key: string]: IconPack;
}

export interface IconLookup {
  prefix: IconPrefix;
  iconName: IconName;
}

declare module '@fortawesome/fontawesome-svg-core' {
  export function icon(icon: IconName | IconLookup, params?: IconParams): Icon;
  export function findIconDefinition(iconLookup: IconLookup): IconDefinition;
}

Reproducible test case

No response

Screenshots

No response

Font Awesome version

v6.3.0

Serving

Kit

Implementation

SVG+JS

Browser and Operating System

  • all

Web bug report checklist

  • I have included a test case because my odds go way up that the team can fix this when I do
  • I have searched for existing issues and to the best of my knowledge this is not a duplicate
@anatolii-babkin anatolii-babkin added bug needs-triage This bug needs to be confirmed labels Mar 23, 2024
@CinkadeusBG
Copy link

I'm having the exact same issue.

@StanislavUngr
Copy link

Is there any progress to this issue? This shouldnt be hard to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-triage This bug needs to be confirmed
Projects
None yet
Development

No branches or pull requests

4 participants