FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
73.53k stars 12.2k forks source link

Bug: cannot find name "IconDefinition" #20246

Open skeet70 opened 3 months ago

skeet70 commented 3 months ago

Bug description

We have a version 6 latest kit that we're importing per the docs with import {faUserShield} from "@awesome.me/kit-{KIT}/icons/classic/solid". We're on Typescript 5.4, nodenext module resolution/target. Running a build produces a ton of

node_modules/@awesome.me/kit-{KIT}/icons/modules/classic/solid.d.ts:11878:26 - error TS2304: Cannot find name 'IconDefinition'.

errors.

Reproducible test case

No response

Screenshots

No response

Font Awesome version

v6.5.2

Serving

Kit

Implementation

SVG+JS

Browser and Operating System

No browser involved. NixOS.

Web bug report checklist

robmadole commented 3 months ago

Hi @skeet70 . We're actively working on some TS fixes and this is part of it. I'll let you know when we've got a fix released.

skeet70 commented 3 months ago

Is there a version we can fall back to where this isn't a problem for now?

robmadole commented 3 months ago

No, unfortunately. Our Kit Package product is pretty new.

jamesarosen commented 2 months ago

I experienced this same problem in a different way. I'm commenting in case it helps anyone else find this bug:

import { faInfo } from '@awesome.me/kit-MYKITID/icons/classic/regular';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

export MyComponent() {
  return <FontAwesomeIcon icon={faInfo} />
}

When I do this, TypeScript gives me the error

Unsafe assignment of an any value

When I trace into the @awesome.me/kit-MYKITID package, I see

// regular.d.ts
export const faInfo: IconDefinition;

When I hover over that, TypeScript tells me

type IconDefinition = /*unresolved*/ any
BobWall23 commented 3 weeks ago

Any update on the status of this?

robmadole commented 3 weeks ago

This issue should now be resolved. @BobWall23 are you running into this still?